├── .gitignore ├── publishable ├── assets │ ├── images │ │ ├── logo-icon.png │ │ ├── loading-spinner-54.gif │ │ └── placeholder-image.jpg │ ├── lib │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── css │ │ │ ├── cropper.min.css │ │ │ ├── toastr.min.css │ │ │ └── select2.min.css │ │ └── js │ │ │ ├── toastr.min.js │ │ │ ├── cropper.min.js │ │ │ └── bootstrap.min.js │ ├── css │ │ └── imagemanager.css │ └── js │ │ └── imagemanager.js └── config │ └── imagemanager.php ├── src ├── Helpers │ └── helpers.php ├── ImagemanagerServiceProvider.php └── Http │ └── Controllers │ └── ImageManagerController.php ├── resources └── views │ ├── deletes.blade.php │ ├── new_folder.blade.php │ ├── datalist.blade.php │ ├── master_clean.blade.php │ ├── cropper.blade.php │ ├── file_manager_modals.blade.php │ ├── upload.blade.php │ └── index.blade.php ├── composer.json ├── routes └── imagemanager.php └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | -------------------------------------------------------------------------------- /publishable/assets/images/logo-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/images/logo-icon.png -------------------------------------------------------------------------------- /publishable/assets/images/loading-spinner-54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/images/loading-spinner-54.gif -------------------------------------------------------------------------------- /publishable/assets/images/placeholder-image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/images/placeholder-image.jpg -------------------------------------------------------------------------------- /publishable/assets/lib/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/lib/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /publishable/assets/lib/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/lib/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /publishable/assets/lib/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/lib/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /publishable/assets/lib/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asmmahmud/laravel-image-manager-cropper/HEAD/publishable/assets/lib/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/Helpers/helpers.php: -------------------------------------------------------------------------------- 1 | 'admin', 5 | 'admin_middleware' => 'admin.auth', 6 | 'base_admin_url' => '/admin', 7 | 'assets_path' => '/vendor/tasmnaguib/imagemanager/assets', 8 | 'storage' => [ 9 | 'disk' => 'public', 10 | ], 11 | 'quality' => 45, 12 | 'thumbnail_size' => '250', 13 | ]; 14 | -------------------------------------------------------------------------------- /resources/views/deletes.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/views/new_folder.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tasmnaguib/imagemanager", 3 | "description": "A Laravel Package for The managing storage file system/images", 4 | "keywords": [ 5 | "laravel", 6 | "image manager", 7 | "file system manager", 8 | "storage manager", 9 | "media manager" 10 | ], 11 | "license": "MIT", 12 | "authors": [ 13 | { 14 | "name": "ASM Mahmudul Hasan", 15 | "email": "asmmahmud@gmail.com" 16 | } 17 | ], 18 | "support": { 19 | "issues": "https://github.com/asmmahmud/laravel-image-manager-cropper/issues", 20 | "source": "https://github.com/asmmahmud/laravel-image-manager-cropper" 21 | }, 22 | "require": { 23 | "illuminate/support": "~5.4.0|~5.5.0", 24 | "intervention/image": "~2.3" 25 | }, 26 | "require-dev": { 27 | "laravel/framework": "5.4.*|5.5.*" 28 | }, 29 | "autoload": { 30 | "psr-4": { 31 | "Tasmnaguib\\Imagemanager\\": "src/" 32 | } 33 | }, 34 | "extra": { 35 | "laravel": { 36 | "providers": [ 37 | "Tasmnaguib\\Imagemanager\\ImagemanagerServiceProvider" 38 | ] 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resources/views/datalist.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | -------------------------------------------------------------------------------- /resources/views/master_clean.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tasmnaguib/Imagemanager 5 | 6 | 7 | 9 | 10 | 11 | @yield('css') 12 | 13 | 14 | 17 |
18 |
19 |
20 |
21 | @yield('content') 22 |
23 |
24 |
25 |
26 | 27 | 28 | 29 | @yield('javascript') 30 | 31 | -------------------------------------------------------------------------------- /routes/imagemanager.php: -------------------------------------------------------------------------------- 1 | $urlPrefix . "/imagemanager"], function () { 6 | $namespacePrefixForMedia = '\\Tasmnaguib\\Imagemanager\\Http\\Controllers\\ImageManagerController'; 7 | Route::get('/', $namespacePrefixForMedia . '@index') 8 | ->name('imagemanager.index'); 9 | Route::post('files', $namespacePrefixForMedia . '@files') 10 | ->name('imagemanager.files'); 11 | Route::post('new_folder', $namespacePrefixForMedia . '@new_folder') 12 | ->name('imagemanager.new_folder'); 13 | Route::post('upload_cropped', $namespacePrefixForMedia . '@uploadCropped') 14 | ->name('imagemanager.upload_cropped_files'); 15 | Route::post('delete_multi_files', $namespacePrefixForMedia . '@delete_multi_files') 16 | ->name('imagemanager.delete_multi_files'); 17 | Route::post('delete_folder', $namespacePrefixForMedia . '@delete_file_folder') 18 | ->name('imagemanager.delete_file_folder'); 19 | Route::get('directories', $namespacePrefixForMedia . '@get_all_dirs') 20 | ->name('imagemanager.get_all_dirs'); 21 | Route::post('move_file', $namespacePrefixForMedia . '@move_file') 22 | ->name('imagemanager.move_file'); 23 | Route::post('rename_file', $namespacePrefixForMedia . '@rename_file') 24 | ->name('imagemanager.rename_file'); 25 | Route::post('upload', $namespacePrefixForMedia . '@upload') 26 | ->name('imagemanager.upload'); 27 | }); 28 | -------------------------------------------------------------------------------- /resources/views/cropper.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ImagemanagerServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->register(ImageServiceProvider::class); 12 | 13 | $this->loadHelpers(); 14 | $this->registerConfigs(); 15 | 16 | if ($this->app->runningInConsole()) { 17 | $this->registerPublishableResources(); 18 | } 19 | } 20 | public function boot(){ 21 | $this->loadRoutesFrom(__DIR__.'/../routes/imagemanager.php'); 22 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'imagemanager'); 23 | } 24 | protected function loadHelpers() { 25 | foreach (glob(__DIR__ . '/Helpers/*.php') as $filename) { 26 | require_once $filename; 27 | } 28 | } 29 | 30 | private function registerPublishableResources() { 31 | $publishablePath = dirname(__DIR__) . '/publishable'; 32 | $publishable = [ 33 | 'imagemanager_assets' => [ 34 | "{$publishablePath}/assets/" => public_path(config('imagemanager.assets_path')), 35 | ], 36 | 'imagemanager_config' => [ 37 | "{$publishablePath}/config/imagemanager.php" => config_path('imagemanager.php'), 38 | ], 39 | ]; 40 | 41 | foreach ($publishable as $group => $paths) { 42 | $this->publishes($paths, $group); 43 | } 44 | } 45 | 46 | public function registerConfigs() { 47 | $this->mergeConfigFrom( 48 | dirname(__DIR__) . '/publishable/config/imagemanager.php', 'imagemanager' 49 | ); 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /resources/views/file_manager_modals.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tasmnaguib Image Manager 2 | Laravel Image manager, uploader, cropper. User also can create different versions of images for different devices like desktop, tablet, mobile etc. 3 | 4 | ## Install 5 | 6 | Create a directory named `packages` in your project root. Download the zip version of the package and unpack it and put the directory 7 | named `tasmnaguib_imagemanager` into this newly created directory. 8 | 9 | After that add the following in your main composer.json file: 10 | ``` bash 11 | "repositories": [ 12 | { 13 | "type": "path", 14 | "url": "./packages/tasmnaguib_imagemanager", 15 | "options": { 16 | "symlink": true 17 | } 18 | } 19 | ], 20 | "require": { 21 | "tasmnaguib/imagemanager": "dev-master" 22 | }, 23 | ``` 24 | After that in the console run: 25 | ``` bash 26 | composer update 27 | ``` 28 | Publish config file and assets using the following commands: 29 | ``` bash 30 | php artisan vendor:publish --tag=imagemanager_config 31 | ``` 32 | ``` bash 33 | php artisan vendor:publish --tag=imagemanager_assets 34 | ``` 35 | 36 | ## Configuration 37 | After publishing the config, you'll find a new config file named 38 | imagemanager.php in the config directory. Here you'll find the following important 39 | options: 40 | 1) `admin_url_prefix` : Url Prefix for admin panel 41 | 2) `admin_middleware` : Admin auth middleware 42 | 3) `quality` : default quality (0 to 100) of the uploaded image 43 | 4) `thumbnail_size` : Thumbnail image size in px 44 | 5) `storage.disk` : Name of the storage engine you're using (ie, s3, local, public etc) 45 | 46 | Note: If you're using local or public storage then don't forget the `run php artisan storage:link` 47 | 48 | ## Usage 49 | After setting up the configuration properly, if you go the url: http://[domainname]/[]admin_url_prefix]/imagemanager, 50 | you'll see the directories and images in your storage file system. 51 | You can do the following things: 52 | 1) Upload new images 53 | 2) Crop images in various predefined ratios (ie 16:9, 3:2 etc) while uploading 54 | 3) Create separate versions of images to display in tablet, mobile, desktop and also for thumbnail size while uploading 55 | 4) Delete images and directories (single click for selection and crl + click for multi selection) 56 | 5) Browse storage file system (double click the directory to enter it) 57 | 6) Move images and directories 58 | 7) Rename images and directories 59 | 60 | In order to properly integrate this package with your admin theme or section, you can customize package's `[package dir]/resources/views/index.blade.php` tempalte file. 61 | This file is using a simplified master blade layout template (`[package dir]/resources/views/master_clean.blade.php`), you can use your own master layout template file. 62 | In order customzie the `[package dir]/resources/views/index.blade.php` file, copy it to `resources/views/vendor/imagemanager` directory and then customize it. 63 | 64 | ## Used libraries: 65 | 66 | 1) [Vue.js](https://github.com/vuejs/vue) 67 | 2) [Cropper.js](https://github.com/fengyuanchen/cropperjs) for image cropping 68 | 3) jquery 69 | 70 | ## License 71 | 72 | The MIT License (MIT). Please see [License File](https://github.com/dnoegel/php-xdg-base-dir/blob/master/LICENSE) for more information. 73 | -------------------------------------------------------------------------------- /publishable/assets/lib/css/cropper.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Cropper v2.3.4 3 | * https://github.com/fengyuanchen/cropper 4 | * 5 | * Copyright (c) 2014-2016 Fengyuan Chen and contributors 6 | * Released under the MIT license 7 | * 8 | * Date: 2016-09-03T05:50:45.412Z 9 | */.cropper-container{font-size:0;line-height:0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;direction:ltr!important}.cropper-container img{display:block;width:100%;min-width:0!important;max-width:none!important;height:100%;min-height:0!important;max-height:none!important;image-orientation:0deg!important}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-wrap-box{overflow:hidden}.cropper-drag-box{opacity:0;background-color:#fff;filter:alpha(opacity=0)}.cropper-dashed,.cropper-modal{opacity:.5;filter:alpha(opacity=50)}.cropper-modal{background-color:#000}.cropper-view-box{display:block;overflow:hidden;width:100%;height:100%;outline:#39f solid 1px;outline-color:rgba(51,153,255,.75)}.cropper-dashed{position:absolute;display:block;border:0 dashed #eee}.cropper-dashed.dashed-h{top:33.33333%;left:0;width:100%;height:33.33333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333%;width:33.33333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-center{position:absolute;top:50%;left:50%;display:block;width:0;height:0;opacity:.75;filter:alpha(opacity=75)}.cropper-center:after,.cropper-center:before{position:absolute;display:block;content:' ';background-color:#eee}.cropper-center:before{top:0;left:-3px;width:7px;height:1px}.cropper-center:after{top:-3px;left:0;width:1px;height:7px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;opacity:.1;filter:alpha(opacity=10)}.cropper-face{top:0;left:0;background-color:#fff}.cropper-line,.cropper-point{background-color:#39f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;opacity:.75;filter:alpha(opacity=75)}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;opacity:1;filter:alpha(opacity=100)}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:' ';opacity:0;background-color:#39f;filter:alpha(opacity=0)}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;opacity:.75;filter:alpha(opacity=75)}}.cropper-invisible{opacity:0;filter:alpha(opacity=0)}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{position:absolute;display:block;width:0;height:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed} -------------------------------------------------------------------------------- /resources/views/upload.blade.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /publishable/assets/lib/js/toastr.min.js: -------------------------------------------------------------------------------- 1 | !function(e){e(["jquery"],function(e){return function(){function t(e,t,n){return g({type:O.error,iconClass:m().iconClasses.error,message:e,optionsOverride:n,title:t})}function n(t,n){return t||(t=m()),v=e("#"+t.containerId),v.length?v:(n&&(v=u(t)),v)}function i(e,t,n){return g({type:O.info,iconClass:m().iconClasses.info,message:e,optionsOverride:n,title:t})}function o(e){w=e}function s(e,t,n){return g({type:O.success,iconClass:m().iconClasses.success,message:e,optionsOverride:n,title:t})}function a(e,t,n){return g({type:O.warning,iconClass:m().iconClasses.warning,message:e,optionsOverride:n,title:t})}function r(e,t){var i=m();v||n(i),l(e,i,t)||d(i)}function c(t){var i=m();return v||n(i),t&&0===e(":focus",t).length?void h(t):void(v.children().length&&v.remove())}function d(t){for(var n=v.children(),i=n.length-1;i>=0;i--)l(e(n[i]),t)}function l(t,n,i){var o=i&&i.force?i.force:!1;return t&&(o||0===e(":focus",t).length)?(t[n.hideMethod]({duration:n.hideDuration,easing:n.hideEasing,complete:function(){h(t)}}),!0):!1}function u(t){return v=e("
").attr("id",t.containerId).addClass(t.positionClass).attr("aria-live","polite").attr("role","alert"),v.appendTo(e(t.target)),v}function p(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'',newestOnTop:!0,preventDuplicates:!1,progressBar:!1}}function f(e){w&&w(e)}function g(t){function i(e){return null==e&&(e=""),new String(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function o(){r(),d(),l(),u(),p(),c()}function s(){y.hover(b,O),!x.onclick&&x.tapToDismiss&&y.click(w),x.closeButton&&k&&k.click(function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&e.cancelBubble!==!0&&(e.cancelBubble=!0),w(!0)}),x.onclick&&y.click(function(e){x.onclick(e),w()})}function a(){y.hide(),y[x.showMethod]({duration:x.showDuration,easing:x.showEasing,complete:x.onShown}),x.timeOut>0&&(H=setTimeout(w,x.timeOut),q.maxHideTime=parseFloat(x.timeOut),q.hideEta=(new Date).getTime()+q.maxHideTime,x.progressBar&&(q.intervalId=setInterval(D,10)))}function r(){t.iconClass&&y.addClass(x.toastClass).addClass(E)}function c(){x.newestOnTop?v.prepend(y):v.append(y)}function d(){t.title&&(I.append(x.escapeHtml?i(t.title):t.title).addClass(x.titleClass),y.append(I))}function l(){t.message&&(M.append(x.escapeHtml?i(t.message):t.message).addClass(x.messageClass),y.append(M))}function u(){x.closeButton&&(k.addClass("toast-close-button").attr("role","button"),y.prepend(k))}function p(){x.progressBar&&(B.addClass("toast-progress"),y.prepend(B))}function g(e,t){if(e.preventDuplicates){if(t.message===C)return!0;C=t.message}return!1}function w(t){var n=t&&x.closeMethod!==!1?x.closeMethod:x.hideMethod,i=t&&x.closeDuration!==!1?x.closeDuration:x.hideDuration,o=t&&x.closeEasing!==!1?x.closeEasing:x.hideEasing;return!e(":focus",y).length||t?(clearTimeout(q.intervalId),y[n]({duration:i,easing:o,complete:function(){h(y),x.onHidden&&"hidden"!==j.state&&x.onHidden(),j.state="hidden",j.endTime=new Date,f(j)}})):void 0}function O(){(x.timeOut>0||x.extendedTimeOut>0)&&(H=setTimeout(w,x.extendedTimeOut),q.maxHideTime=parseFloat(x.extendedTimeOut),q.hideEta=(new Date).getTime()+q.maxHideTime)}function b(){clearTimeout(H),q.hideEta=0,y.stop(!0,!0)[x.showMethod]({duration:x.showDuration,easing:x.showEasing})}function D(){var e=(q.hideEta-(new Date).getTime())/q.maxHideTime*100;B.width(e+"%")}var x=m(),E=t.iconClass||x.iconClass;if("undefined"!=typeof t.optionsOverride&&(x=e.extend(x,t.optionsOverride),E=t.optionsOverride.iconClass||E),!g(x,t)){T++,v=n(x,!0);var H=null,y=e("
"),I=e("
"),M=e("
"),B=e("
"),k=e(x.closeHtml),q={intervalId:null,hideEta:null,maxHideTime:null},j={toastId:T,state:"visible",startTime:new Date,options:x,map:t};return o(),a(),s(),f(j),x.debug&&console&&console.log(j),y}}function m(){return e.extend({},p(),b.options)}function h(e){v||(v=n()),e.is(":visible")||(e.remove(),e=null,0===v.children().length&&(v.remove(),C=void 0))}var v,w,C,T=0,O={error:"error",info:"info",success:"success",warning:"warning"},b={clear:r,remove:c,error:t,getContainer:n,info:i,options:{},subscribe:o,success:s,version:"2.1.2",warning:a};return b}()})}("function"==typeof define&&define.amd?define:function(e,t){"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)}); 2 | //# sourceMappingURL=toastr.js.map -------------------------------------------------------------------------------- /publishable/assets/css/imagemanager.css: -------------------------------------------------------------------------------- 1 | #imagemanager-loader { 2 | background: hsl(0, 0%, 98%) none repeat scroll 0 0; 3 | height: 100%; 4 | left: 0; 5 | opacity: 0.75; 6 | position: fixed; 7 | top: 0; 8 | width: 100%; 9 | z-index: 99; 10 | } 11 | #imagemanager-loader img { 12 | display: block; 13 | margin: 15% auto; 14 | } 15 | .image-manager-page-content {} 16 | .image-manager-page-content .admin-section-title h3 { 17 | margin-top: 5px; 18 | margin-bottom: 20px; 19 | } 20 | .upload-modal .form-group.row { 21 | margin-bottom : 5px; 22 | } 23 | .upload-thumb-row .btn { 24 | } 25 | .size-showing-row, 26 | .aspect-ratio-btn-row, 27 | .checkbox-group { 28 | margin-top : 20px; 29 | } 30 | .size-showing-row > [class*="col-"], 31 | .aspect-ratio-btn-row > [class*="col-"], 32 | .checkbox-group > [class*="col-"] { 33 | margin-bottom: 0; 34 | } 35 | #progress-wrp { 36 | border : 1px solid #0099CC; 37 | padding : 1px; 38 | position : relative; 39 | border-radius : 3px; 40 | margin : 10px; 41 | text-align : left; 42 | background : #fff; 43 | box-shadow : inset 1px 3px 6px rgba(0, 0, 0, 0.12); 44 | } 45 | #progress-wrp .progress-bar { 46 | height : 20px; 47 | border-radius : 3px; 48 | background-color : #f39ac7; 49 | width : 0; 50 | box-shadow : inset 1px 1px 10px rgba(0, 0, 0, 0.11); 51 | } 52 | #progress-wrp .status { 53 | top : 3px; 54 | left : 50%; 55 | position : absolute; 56 | display : inline-block; 57 | color : #000000; 58 | } 59 | #upload_files_modal .modal-body { 60 | min-height: 450px; 61 | padding: 5px 0; 62 | } 63 | #upload_files_modal .modal-header { 64 | padding: 10px; 65 | } 66 | #upload_files_modal .modal-header .close { 67 | float: right; margin: 0 0 0 15px; text-align: right; 68 | } 69 | #upload_files_modal .modal-header .file-btn { 70 | float: left; margin: 0 15px 0 0; text-align: center; cursor: pointer; 71 | } 72 | .upload-modal .upload-thumb-holder { 73 | margin-top : 10px; 74 | } 75 | .upload-modal .upload-cropper-holder { 76 | margin-left: auto; 77 | margin-right: auto; 78 | margin-top: 5px; 79 | max-height: 350px; 80 | max-width: 80%; 81 | position: relative; 82 | } 83 | .upload-cropper-holder #upload-cropper-img { 84 | max-width : 100%; 85 | } 86 | .modal-body .aspect-ratio-btn-group { 87 | min-height : 50px; 88 | } 89 | .modal-body .row .aspect-ratio-btn-group .aspect-ratio-btn { 90 | margin-right : 2px; 91 | float : left; 92 | } 93 | #im-toolbar .glyphicon { 94 | margin-right: 5px; 95 | } 96 | #im-toolbar { 97 | box-shadow: 0 0 5px hsl(0, 0%, 70%); 98 | } 99 | #im-toolbar .btn { 100 | margin-left: 5px; 101 | } 102 | #image-manager .breadcrumb-container { 103 | box-shadow: 0 0 3px; 104 | margin: 10px 0 0; 105 | padding: 0 15px; 106 | position: relative; 107 | } 108 | #im-breadcrumb .breadcrumb { 109 | background: hsla(0, 0%, 0%, 0) none repeat scroll 0 0; 110 | border: 0 none; 111 | border-radius: 0; 112 | margin: 0; 113 | padding: 7px 10px; 114 | position: static; 115 | float: left; 116 | } 117 | #im-breadcrumb .breadcrumb li { 118 | cursor: pointer; 119 | } 120 | #im-breadcrumb .breadcrumb li.active { 121 | cursor: auto; 122 | } 123 | #im-breadcrumb .glyphicon { 124 | margin-right: 5px; 125 | } 126 | #im-breadcrumb .see-details { 127 | float: right; 128 | display: block; 129 | } 130 | #im-content { 131 | padding: 15px 15px 5px; 132 | } 133 | #im-content .im-content-body { 134 | float: left; 135 | } 136 | #im-content .item-details-info { 137 | float: right; 138 | width: 20%; 139 | background: hsl(0, 0%, 100%) none repeat scroll 0 0; 140 | box-shadow: 0 0 5px hsl(0, 0%, 50%); 141 | margin: 0; 142 | padding: 5px 10px; 143 | min-height: 100px; 144 | } 145 | #im-content .item-details-info ul { 146 | margin: 0; 147 | padding: 0; 148 | width: 100%; 149 | } 150 | #im-content .item-details-info li { 151 | border-bottom: 1px solid hsl(0, 0%, 76%); 152 | display: block; 153 | overflow-wrap: break-word; 154 | padding: 7px 0; 155 | text-align: center; 156 | font-size: 12px; 157 | } 158 | #im-content .item-details-info li { 159 | display: block; 160 | padding: 5px 10px; 161 | } 162 | #im-content .item-details-info img.thumb { 163 | height: auto; 164 | max-height: 200px; 165 | width: 100%; 166 | } 167 | #im-content .item { 168 | border: 2px solid hsl(0, 0%, 100%); 169 | box-shadow: 0 0 3px hsl(0, 0%, 70%); 170 | cursor: pointer; 171 | float: left; 172 | height: 180px; 173 | margin-bottom: 10px; 174 | margin-right: 10px; 175 | margin-top: 5px; 176 | width: 12%; 177 | } 178 | #im-content .item:hover { 179 | box-shadow: 1px 1px 5px hsl(0, 0%, 40%); 180 | } 181 | #im-content .item img { 182 | display: block; 183 | height: 100px; 184 | margin: 2px auto 8px; 185 | width: 90%; 186 | } 187 | #im-content .item .folder { 188 | display: block; 189 | width: 90%; 190 | margin: 2px auto; 191 | text-align: center; 192 | } 193 | #im-content .item .folder .glyphicon { 194 | font-size: 50px; 195 | color: #777; 196 | } 197 | #im-content .item .item-name, 198 | #im-content .item .item-dimention { 199 | font-size: 10px; 200 | line-height: 1.1; 201 | margin: 5px auto; 202 | overflow: hidden; 203 | overflow-wrap: break-word; 204 | text-align: center; 205 | width: 90%; 206 | } 207 | #im-content .item .item-dimention { 208 | margin: 5px auto; 209 | border-top: 1px solid #e1e1e1; 210 | padding-top: 3px; 211 | } 212 | #im-content .dir .item-name { 213 | font-size: 12px; 214 | } 215 | #im-content .selected { 216 | border-color: hsl(0, 50%, 75%); 217 | } 218 | 219 | 220 | -------------------------------------------------------------------------------- /publishable/assets/lib/css/toastr.min.css: -------------------------------------------------------------------------------- 1 | .toast-title{font-weight:700}.toast-message{-ms-word-wrap:break-word;word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}.toast-message a:hover{color:#ccc;text-decoration:none}.toast-close-button{position:relative;right:-.3em;top:-.3em;float:right;font-size:20px;font-weight:700;color:#fff;-webkit-text-shadow:0 1px 0 #fff;text-shadow:0 1px 0 #fff;opacity:.8;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);filter:alpha(opacity=80)}.toast-close-button:focus,.toast-close-button:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=40);filter:alpha(opacity=40)}button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.toast-top-center{top:0;right:0;width:100%}.toast-bottom-center{bottom:0;right:0;width:100%}.toast-top-full-width{top:0;right:0;width:100%}.toast-bottom-full-width{bottom:0;right:0;width:100%}.toast-top-left{top:12px;left:12px}.toast-top-right{top:12px;right:12px}.toast-bottom-right{right:12px;bottom:12px}.toast-bottom-left{bottom:12px;left:12px}#toast-container{position:fixed;z-index:999999;pointer-events:none}#toast-container *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#toast-container>div{position:relative;pointer-events:auto;overflow:hidden;margin:0 0 6px;padding:15px 15px 15px 50px;width:300px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius: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:.8;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);filter:alpha(opacity=80)}#toast-container>:hover{-moz-box-shadow:0 0 12px #000;-webkit-box-shadow:0 0 12px #000;box-shadow:0 0 12px #000;opacity:1;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);filter:alpha(opacity=100);cursor:pointer}#toast-container>.toast-info{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=)!important}#toast-container>.toast-error{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}#toast-container>.toast-success{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==)!important}#toast-container>.toast-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=)!important}#toast-container.toast-bottom-center>div,#toast-container.toast-top-center>div{width:300px;margin-left:auto;margin-right:auto}#toast-container.toast-bottom-full-width>div,#toast-container.toast-top-full-width>div{width:96%;margin-left:auto;margin-right:auto}.toast{background-color:#030303}.toast-success{background-color:#51a351}.toast-error{background-color:#bd362f}.toast-info{background-color:#2f96b4}.toast-warning{background-color:#f89406}.toast-progress{position:absolute;left:0;bottom:0;height:4px;background-color:#000;opacity:.4;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=40);filter:alpha(opacity=40)}@media all and (max-width:240px){#toast-container>div{padding:8px 8px 8px 50px;width:11em}#toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width:241px) and (max-width:480px){#toast-container>div{padding:8px 8px 8px 50px;width:18em}#toast-container .toast-close-button{right:-.2em;top:-.2em}}@media all and (min-width:481px) and (max-width:768px){#toast-container>div{padding:15px 15px 15px 50px;width:25em}} -------------------------------------------------------------------------------- /resources/views/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('imagemanager::master_clean') 2 | @section('css') 3 | 4 | 5 | @endsection 6 | @section('content') 7 | @include('imagemanager::datalist') 8 |
9 |
10 |
11 |
12 |

Image Manager

13 |
14 |
15 |
16 |
17 | 20 | 22 |
23 |
24 | 27 | 29 | 32 | 35 |
36 |
37 |
38 | 49 |
50 |
51 | 68 |
69 |
70 |
    71 | 85 | 89 | 94 |
95 |
96 |
97 | @include('imagemanager::file_manager_modals') 98 |
99 | @include('imagemanager::new_folder') 100 | @include('imagemanager::deletes') 101 | @include('imagemanager::upload') 102 |
103 |
104 |
105 | 106 | @stop 107 | @section('javascript') 108 | 109 | 110 | 135 | 136 | @endsection -------------------------------------------------------------------------------- /publishable/assets/lib/css/select2.min.css: -------------------------------------------------------------------------------- 1 | .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:34px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #e4eaec;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #e4eaec;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#76838f;line-height:34px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:34px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #e4eaec;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #e4eaec;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid #000 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #e4eaec}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #e4eaec;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#76838f;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #e4eaec;border-top-right-radius:4px;border-bottom-right-radius:4px;height:34px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #e4eaec;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #e4eaec;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #e4eaec;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #e4eaec;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} 2 | -------------------------------------------------------------------------------- /src/Http/Controllers/ImageManagerController.php: -------------------------------------------------------------------------------- 1 | filesystem string */ 20 | private $filesystem; 21 | /** @var $this ->fileSystemConfigPath string */ 22 | private $fileSystemConfigPath; 23 | /** @var $this ->fileSystemRootDir string */ 24 | private $fileSystemRootDir; 25 | private $storageDisk; 26 | private $thumbDir = ''; 27 | private $directory = ''; 28 | private $allowedMimeType = array(); 29 | 30 | public function __construct() 31 | { 32 | $adminMiddleware = config('imagemanager.admin_middleware'); 33 | if ($adminMiddleware) { 34 | $this->middleware(['web', $adminMiddleware]); 35 | } else { 36 | $this->middleware('web'); 37 | } 38 | $this->filesystem = config('imagemanager.storage.disk'); 39 | $this->fileSystemConfigPath = 'filesystems.disks.' . $this->filesystem; 40 | $this->fileSystemRootDir = config($this->fileSystemConfigPath . '.root'); 41 | $this->storageDisk = Storage::disk($this->filesystem); 42 | $this->thumbDir = 'thumbs'; 43 | $this->allowedMimeType = array('image/jpeg', 'image/gif', 'image/png'); 44 | } 45 | 46 | protected function getFileDirPath($name) 47 | { 48 | return $this->fileSystemRootDir . DIRECTORY_SEPARATOR . $name; 49 | } 50 | 51 | public function index(Request $request) 52 | { 53 | return view('imagemanager::index', compact('is_image_browser')); 54 | } 55 | 56 | public function files(Request $request) 57 | { 58 | $dirLocation = $request->input('dir_location'); 59 | $items = $this->getFiles($dirLocation); 60 | 61 | return response()->json( 62 | array('relativePath' => $dirLocation, 'items' => $items) 63 | ); 64 | } 65 | 66 | public function new_folder(Request $request) 67 | { 68 | $dirLocation = $request->input('dir_location'); 69 | $dirLocation = $this->preparePath($dirLocation); 70 | $newFolderName = $request->input('new_folder_name'); 71 | 72 | $success = false; 73 | $error = ''; 74 | if (empty($newFolderName)) { 75 | $error = 'Folder name is empty.'; 76 | 77 | return compact('success', 'error'); 78 | } 79 | 80 | if ($dirLocation != '') { 81 | $newFolderPath = $dirLocation . '/' . $newFolderName; 82 | } else { 83 | $newFolderPath = $newFolderName; 84 | } 85 | 86 | if ($this->storageDisk->exists($newFolderPath)) { 87 | $error = 'Folder (' . $newFolderName . ') already exists.'; 88 | } elseif ($this->storageDisk->makeDirectory($newFolderPath)) { 89 | $success = true; 90 | } else { 91 | $error = 'Something went wrong, please check your permissions.'; 92 | } 93 | 94 | return compact('success', 'error'); 95 | } 96 | 97 | protected function preparePath($path, $before = true, $after = true) 98 | { 99 | if ($before && strpos($path, '/') === 0) { 100 | $path = substr($path, 1); 101 | } 102 | if ($after && strrpos($path, '/') === (strlen($path) - 1)) { 103 | $path = substr($path, 0, -1); 104 | } 105 | 106 | return $path; 107 | } 108 | 109 | public function rename_file(Request $request) 110 | { 111 | $dirLocation = $request->input('dir_location'); 112 | $dirLocation = $this->preparePath($dirLocation); 113 | $oldName = $request->input('old_name'); 114 | $newName = $request->input('new_name'); 115 | $success = false; 116 | $error = false; 117 | 118 | if ($dirLocation != '') { 119 | $oldFullPath = $dirLocation . '/' . $oldName; 120 | $newFullPath = $dirLocation . '/' . $newName; 121 | } else { 122 | $oldFullPath = $oldName; 123 | $newFullPath = $newName; 124 | } 125 | 126 | if (!$this->storageDisk->exists($newFullPath)) { 127 | if ($this->storageDisk->exists($oldFullPath) && $this->storageDisk->move($oldFullPath, $newFullPath)) { 128 | $success = true; 129 | } else { 130 | $error = 'something went wrong, please check the correct permissions.'; 131 | } 132 | } else { 133 | $error = 'File/Folder may already exist with that name. Please choose another name or delete the other file.'; 134 | } 135 | 136 | return compact('success', 'error'); 137 | } 138 | 139 | public function delete_multi_files(Request $request) 140 | { 141 | $dirLocation = $request->input('dir_location'); 142 | $dirLocation = $this->preparePath($dirLocation); 143 | 144 | $filesToDelete = $request->input('files_to_delete'); 145 | $dirsToDelete = $request->input('dirs_to_delete'); 146 | 147 | $countSelectedFiles = count($filesToDelete); 148 | $countSelectedDirs = count($dirsToDelete); 149 | 150 | $countDelfiles = $countDelDirs = 0; 151 | $fileError = $dirError = ""; 152 | if ($countSelectedFiles) { 153 | try { 154 | foreach ($filesToDelete as $itemToDelete) { 155 | if ($dirLocation) { 156 | $fullPath = $dirLocation . '/' . $itemToDelete; 157 | } else { 158 | $fullPath = $itemToDelete; 159 | } 160 | 161 | if ($this->storageDisk->delete($fullPath)) { 162 | $countDelfiles++; 163 | } 164 | } 165 | } catch (\Exception $e) { 166 | $fileError = $e->getMessage(); 167 | } 168 | } 169 | if ($countSelectedDirs) { 170 | try { 171 | foreach ($dirsToDelete as $itemToDelete) { 172 | if ($dirLocation) { 173 | $fullPath = $dirLocation . '/' . $itemToDelete; 174 | } else { 175 | $fullPath = $itemToDelete; 176 | } 177 | 178 | if ($this->storageDisk->deleteDirectory($fullPath)) { 179 | $countDelDirs++; 180 | } 181 | } 182 | } catch (\Exception $e) { 183 | $dirError = $e->getMessage(); 184 | } 185 | } 186 | 187 | return compact('fileError', 'dirError', 'countDelDirs', 'countDelfiles'); 188 | 189 | } 190 | 191 | // GET ALL DIRECTORIES Working with Laravel 5.3 192 | public function get_all_dirs() 193 | { 194 | return response()->json($this->storageDisk->directories(null, true)); 195 | } 196 | 197 | // NEEDS TESTING 198 | public function move_file(Request $request) 199 | { 200 | 201 | $destinationDir = $request->input('destination_dir'); 202 | $destinationDir = $this->preparePath($destinationDir); 203 | 204 | $sourceDir = $request->input('source_dir'); 205 | $sourceDir = $this->preparePath($sourceDir); 206 | 207 | $filesToMove = $request->input('files_to_move'); 208 | $dirsToMove = $request->input('dirs_to_move'); 209 | /* logger($filesToMove); 210 | logger($dirsToMove);*/ 211 | $countSelectedFiles = count($filesToMove); 212 | $countSelectedDirs = count($dirsToMove); 213 | 214 | $countMovefiles = $countMoveDirs = 0; 215 | $fileError = $dirError = ""; 216 | if ($countSelectedFiles) { 217 | try { 218 | foreach ($filesToMove as $item) { 219 | if ($sourceDir) { 220 | $sourceFullPath = $sourceDir . '/' . $item; 221 | } else { 222 | $sourceFullPath = $item; 223 | } 224 | if ($destinationDir) { 225 | $destinationFullPath = $destinationDir . '/' . $item; 226 | } else { 227 | $destinationFullPath = $item; 228 | } 229 | /* logger($sourceFullPath . '--' . $destinationFullPath);*/ 230 | if ($this->storageDisk->move($sourceFullPath, $destinationFullPath)) { 231 | logger('moved file: ' . $sourceFullPath . ' to ' . $destinationFullPath); 232 | $countMovefiles++; 233 | } 234 | } 235 | } catch (\Exception $e) { 236 | $fileError = $e->getMessage(); 237 | logger($fileError); 238 | 239 | } 240 | } 241 | if ($countSelectedDirs) { 242 | try { 243 | foreach ($dirsToMove as $item) { 244 | if ($sourceDir) { 245 | $sourceFullPath = $sourceDir . '/' . $item; 246 | } else { 247 | $sourceFullPath = $item; 248 | } 249 | if ($destinationDir) { 250 | $destinationFullPath = $destinationDir . '/' . $item; 251 | } else { 252 | $destinationFullPath = $item; 253 | } 254 | 255 | logger($sourceFullPath . '--' . $destinationFullPath); 256 | if ($this->storageDisk->move($sourceFullPath, $destinationFullPath)) { 257 | logger('moved file: ' . $sourceFullPath . ' to ' . $destinationFullPath); 258 | $countMoveDirs++; 259 | } 260 | } 261 | } catch (\Exception $e) { 262 | $dirError = $e->getMessage(); 263 | logger($dirError); 264 | } 265 | } 266 | return compact('fileError', 'dirError', 'countMoveDirs', 'countMovefiles'); 267 | } 268 | 269 | public function uploadCropped(Request $request) 270 | { 271 | $croppedImage = $request->input('croppedImage'); 272 | $uploadPathBase = $request->input('upload_path'); 273 | $uploadPathBase = $this->preparePath($uploadPathBase); 274 | $devicesVersion = json_decode($request->input('devices_version', '')); 275 | 276 | $imageQuality = $request->input('image_quality'); 277 | $fileName = $request->input('file_name'); 278 | $extension = $request->input('ext'); 279 | if (!$fileName) { 280 | $fileName = Str::random(25); 281 | } 282 | if (!$extension) { 283 | $extension = '.jpg'; 284 | } 285 | /* $interventionImage = Image::make((string)$croppedImage);*/ 286 | $configQuality = config('imagemanager.quality'); 287 | 288 | if (!$imageQuality && isset($configQuality) && $configQuality) { 289 | $imageQuality = $configQuality; 290 | } else if (!$imageQuality) { 291 | $imageQuality = 50; 292 | } 293 | 294 | $storagePathPrefix = $this->storageDisk->getDriver()->getAdapter()->getPathPrefix(); 295 | 296 | if (count($devicesVersion)) { 297 | $uploadPath = $uploadPathBase; 298 | $devicesVersion[] = 'cropped'; 299 | foreach ($devicesVersion as $version) { 300 | if ($version === 'thumb') { 301 | $verDir = $version; 302 | $verSize = config('imagemanager.thumbnail_size'); 303 | } else if ($version === 'cropped') { 304 | $verDir = ''; 305 | $verSize = false; 306 | } else { 307 | $verDir = $version . 'px'; 308 | $verSize = $version; 309 | } 310 | if ($uploadPath && $verDir) { 311 | $uploadPath .= '/' . $verDir . '/'; 312 | } else if ($uploadPath) { 313 | $uploadPath .= '/'; 314 | } else if ($verDir) { 315 | $uploadPath = $verDir . '/'; 316 | } 317 | 318 | if (!$this->storageDisk->exists($uploadPath)) { 319 | $this->storageDisk->makeDirectory($uploadPath); 320 | } 321 | 322 | $filePath = $storagePathPrefix . $uploadPath . $fileName . $extension; 323 | 324 | if ($verSize) { 325 | Image::make((string)$croppedImage)->resize( 326 | $verSize, 327 | null, 328 | function (Constraint $constraint) { 329 | $constraint->aspectRatio(); 330 | })->save($filePath, $imageQuality); 331 | } else { 332 | Image::make((string)$croppedImage)->save($filePath, $imageQuality); 333 | } 334 | $uploadPath = $uploadPathBase; 335 | } 336 | } 337 | 338 | $success = true; 339 | $message = 'Successfully uploaded new file!'; 340 | return response()->json(compact('success', 'message')); 341 | } 342 | 343 | protected function uploadRescale($file, $filePath, $imageQuality, $width = null) 344 | { 345 | $smallImage = Image::make($file)->resize( 346 | null, 347 | null, 348 | function (Constraint $constraint) { 349 | $constraint->aspectRatio(); 350 | }); 351 | 352 | $smallImage->save($filePath, $imageQuality); 353 | } 354 | 355 | private function getImageThumb($file) 356 | { 357 | $path_parts = pathinfo($file); 358 | if (count($path_parts) == 4) { 359 | $fileName = $path_parts['dirname'] . DIRECTORY_SEPARATOR . $this->thumbDir . DIRECTORY_SEPARATOR . $path_parts['filename'] . $path_parts['extension']; 360 | if ($this->storageDisk->exists($fileName)) { 361 | return $this->storageDisk->url($fileName); 362 | } 363 | } 364 | 365 | return $this->storageDisk->url($file); 366 | } 367 | 368 | private function getFiles($dir) 369 | { 370 | $files = []; 371 | $storageFiles = $this->storageDisk->files($dir); 372 | $storageFolders = $this->storageDisk->directories($dir); 373 | $index = 0; 374 | foreach ($storageFiles as $file) { 375 | $fileMimeType = $this->storageDisk->mimeType($file); 376 | if (!in_array($fileMimeType, $this->allowedMimeType)) { 377 | continue; 378 | } 379 | $imageInfo = getimagesize($this->getFileDirPath($file)); 380 | $imageOriWidth = 0; 381 | if (isset($imageInfo[0])) { 382 | $imageOriWidth = $imageInfo[0]; 383 | } 384 | $imageOriHeight = 0; 385 | if (isset($imageInfo[1])) { 386 | $imageOriHeight = $imageInfo[1]; 387 | } 388 | $lastMod = $this->storageDisk->lastModified($file); 389 | $lastMod = \Carbon\Carbon::createFromTimestamp($lastMod, config('app.timezone')); 390 | $files[] = [ 391 | 'index' => $index, 392 | 'is_selected' => false, 393 | 'name' => strpos($file, '/') > 1 ? str_replace('/', '', strrchr($file, '/')) : $file, 394 | 'type' => $fileMimeType, 395 | 'public_url' => $this->storageDisk->url($file), 396 | 'thumbnail' => $this->getImageThumb($file), 397 | 'relative_path' => $file, 398 | 'size' => $this->storageDisk->size($file), 399 | 'last_modified' => $lastMod->format('Y-m-d h:i:s A'), 400 | 'dimention' => (($imageOriWidth && $imageOriHeight) ? $imageOriWidth . ' x ' . $imageOriHeight : null), 401 | ]; 402 | $index++; 403 | } 404 | 405 | foreach ($storageFolders as $folder) { 406 | $files[] = [ 407 | 'index' => $index, 408 | 'is_selected' => false, 409 | 'name' => strpos($folder, '/') > 1 ? str_replace('/', '', strrchr($folder, '/')) : $folder, 410 | 'type' => 'directory', 411 | 'relative_path' => $folder, 412 | 'items' => '', 413 | 'last_modified' => '', 414 | ]; 415 | $index++; 416 | } 417 | return $files; 418 | } 419 | } 420 | -------------------------------------------------------------------------------- /publishable/assets/js/imagemanager.js: -------------------------------------------------------------------------------- 1 | var vm = new Vue({ 2 | el: "#im_app", 3 | data: { 4 | items: [], 5 | curRelativePath: "/", 6 | selectedItems: [], 7 | allDirectories: [], 8 | showDetails: false 9 | }, 10 | computed: { 11 | detailAnchorText: function () { 12 | if (this.showDetails) { 13 | return "Hide Details"; 14 | } else { 15 | return "Show Details"; 16 | } 17 | }, 18 | styleObjectMain: function () { 19 | if (this.showDetails) { 20 | return {width: "80%"}; 21 | } else { 22 | return {width: "100%"}; 23 | } 24 | }, 25 | styleObjectSideDetail: function () { 26 | if (this.showDetails) { 27 | return {width: "20%", display: "block"}; 28 | } else { 29 | return {width: "0%", display: "none"}; 30 | } 31 | }, 32 | showFileDetails: function () { 33 | return ( 34 | this.selectionDetails.fileSelected === 1 && 35 | this.selectionDetails.directorySelected === 0 36 | ); 37 | }, 38 | relativePaths: function () { 39 | if (this.curRelativePath !== "" && this.curRelativePath !== "/") { 40 | return this.curRelativePath.split("/"); 41 | } 42 | return []; 43 | }, 44 | selectionDetails: function () { 45 | let details = { 46 | selectedItem: null, 47 | directorySelected: 0, 48 | fileSelected: 0 49 | }; 50 | let selLength = this.selectedItems.length; 51 | for (let i = 0; i < selLength; i++) { 52 | if (this.items[this.selectedItems[i]].type === "directory") { 53 | details.directorySelected++; 54 | } else { 55 | details.fileSelected++; 56 | } 57 | } 58 | if (details.fileSelected === 1 && details.directorySelected === 0) { 59 | details.selectedItem = this.items[this.selectedItems[0]]; 60 | } 61 | return details; 62 | } 63 | }, 64 | mounted() { 65 | this.loadItems(); 66 | this.loadIDirectoies(); 67 | }, 68 | methods: { 69 | refresh: function () { 70 | this.loadItems(); 71 | }, 72 | toggleDetail: function () { 73 | this.showDetails = !this.showDetails; 74 | }, 75 | checkSelection: function (index, e) { 76 | let indexPos; 77 | if (e.ctrlKey) { 78 | indexPos = this.selectedItems.indexOf(index); 79 | 80 | if (indexPos >= 0) { 81 | this.selectedItems.splice(indexPos, 1); 82 | } else { 83 | this.selectedItems.push(index); 84 | } 85 | } else { 86 | this.selectedItems = [index]; 87 | } 88 | }, 89 | goInFromBread: function (index) { 90 | let newRelativePath; 91 | if (index >= 0) { 92 | newRelativePath = this.relativePaths 93 | .slice(0, index + 1) 94 | .join("/"); 95 | } else { 96 | newRelativePath = "/"; 97 | } 98 | this.loadItems(newRelativePath); 99 | }, 100 | loadItems: function (relativePath) { 101 | if (!relativePath) { 102 | relativePath = this.curRelativePath; 103 | } 104 | $.ajax({ 105 | method: "POST", 106 | url: defaultOp.baseUrl + "/imagemanager/files", 107 | data: { 108 | dir_location: relativePath, 109 | _token: defaultOp.CSRF_TOKEN 110 | }, 111 | dataType: "json", 112 | context: this 113 | }) 114 | .success(function (dirData) { 115 | this.items = dirData.items; 116 | this.curRelativePath = dirData.relativePath; 117 | this.selectedItems = []; 118 | }) 119 | .fail(function (jqXHR, textStatus, errorThrown) { 120 | toastr.error(errorThrown, textStatus); 121 | }); 122 | }, 123 | loadIDirectoies: function () { 124 | $.ajax({ 125 | url: defaultOp.baseUrl + "/imagemanager/directories", 126 | dataType: "json", 127 | context: this 128 | }) 129 | .done(function (dirData) { 130 | this.allDirectories = dirData; 131 | }) 132 | .fail(function (jqXHR, textStatus, errorThrown) { 133 | toastr.error(errorThrown, textStatus); 134 | }); 135 | } 136 | } 137 | }); 138 | 139 | function imageManager() { 140 | function makeRandom() { 141 | var text = ""; 142 | var possible = 143 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 144 | for (let i = 0; i < 20; i++) { 145 | text += possible.charAt( 146 | Math.floor(Math.random() * possible.length) 147 | ); 148 | } 149 | return text; 150 | } 151 | 152 | $("#refresh").click(function () { 153 | vm.loadItems(); 154 | }); 155 | 156 | $("#new_folder").click(function () { 157 | $("#new_folder_modal").modal("show"); 158 | }); 159 | 160 | $("#new_folder_modal").on("shown.bs.modal", function () { 161 | $("#new_folder_name").focus(); 162 | }); 163 | 164 | $("#new_folder_name").keydown(function (e) { 165 | if (e.which == 13) { 166 | $("#new_folder_submit").trigger("click"); 167 | } 168 | }); 169 | $("#new_folder_submit").click(function () { 170 | var newFolderName = $("#new_folder_name").val(); 171 | if (newFolderName.trim() === "") { 172 | return; 173 | } 174 | $.ajax({ 175 | method: "POST", 176 | url: defaultOp.baseUrl + "/imagemanager/new_folder", 177 | data: { 178 | dir_location: vm.curRelativePath, 179 | new_folder_name: newFolderName.trim(), 180 | _token: defaultOp.CSRF_TOKEN 181 | }, 182 | beforeSend: function () { 183 | $("#new_folder_submit").attr("disabled", true); 184 | } 185 | }) 186 | .success(function (data) { 187 | if (data.success) { 188 | toastr.success( 189 | "successfully created " + $("#new_folder_name").val(), 190 | "Sweet Success!" 191 | ); 192 | vm.loadItems(); 193 | vm.loadIDirectoies(); 194 | } else { 195 | toastr.error(data.error, "Whoops!"); 196 | } 197 | 198 | $("#new_folder_name").val(""); 199 | $("#new_folder_submit").attr("disabled", false); 200 | $("#new_folder_modal").modal("hide"); 201 | }) 202 | .fail(function (jqXHR, textStatus, errorThrown) { 203 | toastr.error(errorThrown, textStatus); 204 | }); 205 | }); 206 | /******************* RENAME SECTION *************************/ 207 | $("#rename").click(function () { 208 | if ( 209 | vm.selectedItems.length === 1 && 210 | typeof vm.items[vm.selectedItems[0]] !== "undefined" 211 | ) { 212 | $("#rename_file_modal").modal("show"); 213 | $("#rename_file_folder_name").val( 214 | vm.items[vm.selectedItems[0]].name 215 | ); 216 | } else { 217 | if (vm.selectedItems.length > 1) { 218 | toastr.error("Select a single item.", "Whoops!"); 219 | } else { 220 | if (vm.selectedItems.length === 0) { 221 | toastr.error("Select an item.", "Whoops!"); 222 | } else { 223 | toastr.error("There seems to be a problem.", "Whoops!"); 224 | } 225 | } 226 | } 227 | }); 228 | $("#rename_file_modal").on("shown.bs.modal", function () { 229 | $("#rename_file_folder_name").focus(); 230 | }); 231 | $("#rename_file_folder_name").keydown(function (e) { 232 | if (e.which === 13) { 233 | $("#rename_submit_btn").trigger("click"); 234 | } 235 | }); 236 | $("#rename_submit_btn").click(function () { 237 | let renameFileFolderName = $("#rename_file_folder_name").val(); 238 | if ( 239 | !renameFileFolderName.trim() || 240 | !(vm.selectedItems.length === 1 && 241 | typeof vm.items[vm.selectedItems[0]] !== "undefined") 242 | ) { 243 | return; 244 | } 245 | $.ajax({ 246 | method: "POST", 247 | url: defaultOp.baseUrl + "/imagemanager/rename_file", 248 | data: { 249 | dir_location: vm.curRelativePath, 250 | old_name: vm.items[vm.selectedItems[0]].name, 251 | new_name: renameFileFolderName.trim(), 252 | _token: defaultOp.CSRF_TOKEN 253 | }, 254 | beforeSend: function () { 255 | $("#rename_submit_btn").attr("disabled", true); 256 | } 257 | }) 258 | .success(function (data, textStatus, jqXHR) { 259 | if (data.success === true) { 260 | toastr.success( 261 | "File/Folder successfully renamed.", 262 | "Success!" 263 | ); 264 | vm.loadItems(); 265 | vm.loadIDirectoies(); 266 | } else { 267 | toastr.error(data.error, "Whoops!"); 268 | } 269 | $("#rename_file_folder_name").val(""); 270 | $("#rename_file_modal").modal("hide"); 271 | }) 272 | .fail(function (jqXHR, textStatus, errorThrown) { 273 | toastr.error(errorThrown, textStatus); 274 | }).always(function () { 275 | $("#rename_submit_btn").attr("disabled", false); 276 | }); 277 | }); 278 | /******************* DELETE SECTION *************************/ 279 | $("#delete").click(function () { 280 | if (vm.selectedItems.length <= 0) { 281 | toastr.error("Select an item.", "Whoops!"); 282 | } else { 283 | $("#confirm_multi_delete_modal").modal("show"); 284 | } 285 | }); 286 | $("#confirm_delete_multi_files").click(function () { 287 | var files_to_delete = [], 288 | elementIndex, 289 | dirs_to_delete = [], 290 | dLength = vm.selectedItems.length; 291 | for (let i = 0; i < dLength; i++) { 292 | elementIndex = vm.selectedItems.pop(); 293 | if ( 294 | elementIndex !== false && 295 | typeof vm.items[elementIndex] !== "undefined" 296 | ) { 297 | if (vm.items[elementIndex].type === "directory") { 298 | dirs_to_delete.push(vm.items[elementIndex].name); 299 | } else { 300 | files_to_delete.push(vm.items[elementIndex].name); 301 | } 302 | } 303 | } 304 | if (files_to_delete.length > 0 || dirs_to_delete.length > 0) { 305 | $.ajax({ 306 | method: "POST", 307 | url: defaultOp.baseUrl + "/imagemanager/delete_multi_files", 308 | data: { 309 | dir_location: vm.curRelativePath, 310 | "files_to_delete[]": files_to_delete, 311 | "dirs_to_delete[]": dirs_to_delete, 312 | _token: defaultOp.CSRF_TOKEN 313 | }, 314 | beforeSend: function () { 315 | $("#confirm_delete_multi_files").attr("disabled", true); 316 | } 317 | }) 318 | .success(function (data, textStatus, jqXHR) { 319 | if (data.countDelfiles || data.countDelDirs) { 320 | toastr.success( 321 | data.countDelfiles + 322 | " file(s) and " + 323 | data.countDelDirs + 324 | " directory(s) successfully deleted", 325 | "Success!" 326 | ); 327 | vm.loadItems(); 328 | if (data.countDelDirs) { 329 | vm.loadIDirectoies(); 330 | } 331 | } else { 332 | if (data.fileError) { 333 | toastr.error(data.fileError, "Whoops!"); 334 | } else { 335 | if (data.dirError) { 336 | toastr.error(data.dirError, "Whoops!"); 337 | } else { 338 | toastr.error(textStatus, "Whoops!"); 339 | } 340 | } 341 | } 342 | $("#confirm_delete_multi_files").attr("disabled", false); 343 | $("#confirm_multi_delete_modal").modal("hide"); 344 | }) 345 | .fail(function (jqXHR, textStatus, errorThrown) { 346 | toastr.error(errorThrown, textStatus); 347 | }); 348 | } 349 | }); 350 | /******************* Move SECTION *************************/ 351 | $("#move").click(function () { 352 | if (vm.selectedItems.length <= 0) { 353 | toastr.error("Select alleast an item to move.", "Whoops!"); 354 | } else { 355 | $("#move_file_modal").modal("show"); 356 | } 357 | }); 358 | $("#move_btn").click(function () { 359 | var files_to_move = [], 360 | elementIndex, 361 | dirs_to_move = [], 362 | dLength = vm.selectedItems.length, 363 | destination = $("#move_folder_dropdown").val(); 364 | 365 | if (!destination.trim()) { 366 | return; 367 | } 368 | for (let i = 0; i < dLength; i++) { 369 | elementIndex = vm.selectedItems.pop(); 370 | if ( 371 | elementIndex !== false && 372 | typeof vm.items[elementIndex] !== "undefined" 373 | ) { 374 | if (vm.items[elementIndex].type === "directory") { 375 | dirs_to_move.push(vm.items[elementIndex].name); 376 | } else { 377 | files_to_move.push(vm.items[elementIndex].name); 378 | } 379 | } 380 | } 381 | if (files_to_move.length > 0 || dirs_to_move.length > 0) { 382 | $.ajax({ 383 | method: "POST", 384 | url: defaultOp.baseUrl + "/imagemanager/move_file", 385 | data: { 386 | destination_dir: destination.trim(), 387 | source_dir: vm.curRelativePath, 388 | "files_to_move[]": files_to_move, 389 | "dirs_to_move[]": dirs_to_move, 390 | _token: defaultOp.CSRF_TOKEN 391 | }, 392 | beforeSend: function () { 393 | $("#move_btn").attr("disabled", true); 394 | } 395 | }) 396 | .success(function (data, textStatus, jqXHR) { 397 | if (data.countMovefiles || data.countMoveDirs) { 398 | toastr.success( 399 | data.countMovefiles + 400 | " file(s) and " + 401 | data.countMoveDirs + 402 | " directory(s) successfully moved", 403 | "Success!" 404 | ); 405 | vm.loadItems(); 406 | vm.loadIDirectoies(); 407 | } else { 408 | if (data.fileError) { 409 | toastr.error(data.fileError, "Whoops!"); 410 | } else { 411 | if (data.dirError) { 412 | toastr.error(data.dirError, "Whoops!"); 413 | } else { 414 | toastr.error(textStatus, "Whoops!"); 415 | } 416 | } 417 | } 418 | $("#move_btn").attr("disabled", false); 419 | $("#move_file_modal").modal("hide"); 420 | }) 421 | .fail(function (jqXHR, textStatus, errorThrown) { 422 | toastr.error(errorThrown, textStatus); 423 | }); 424 | } 425 | }); 426 | 427 | /********** UPLOAD SECTION **********************/ 428 | function destroyCropper() { 429 | defaultOp.cropBoxData = defaultOp.cropperImage.cropper( 430 | "getCropBoxData" 431 | ); 432 | defaultOp.canvasData = defaultOp.cropperImage.cropper("getCanvasData"); 433 | defaultOp.cropperImage.cropper("destroy"); 434 | } 435 | 436 | function resetCropper(aspRatio, srcUrl) { 437 | if (defaultOp.cropperImage.data("cropper")) { 438 | destroyCropper(); 439 | } 440 | if (aspRatio === false) { 441 | aspRatio = 16 / 9; 442 | } 443 | if (srcUrl) { 444 | defaultOp.cropperImage.attr("src", srcUrl); 445 | let tempImage = new Image(); 446 | tempImage.src = srcUrl; 447 | tempImage.onload = function () { 448 | $("#original_width").text(tempImage.naturalWidth.toFixed(2)); 449 | $("#original_height").text(tempImage.naturalHeight.toFixed(2)); 450 | }; 451 | } 452 | defaultOp.cropperImage.cropper({ 453 | aspectRatio: aspRatio, 454 | autoCropArea: 0.75, 455 | ready: function () { 456 | defaultOp.cropperImage.cropper( 457 | "setCanvasData", 458 | defaultOp.canvasData 459 | ); 460 | defaultOp.cropperImage.cropper( 461 | "setCropBoxData", 462 | defaultOp.cropBoxData 463 | ); 464 | }, 465 | crop: function (e) { 466 | $("#cropped_width").text(e.width.toFixed(2)); 467 | $("#cropped_height").text(e.height.toFixed(2)); 468 | } 469 | }); 470 | } 471 | 472 | function renderImage(fileOb) { 473 | var imageType = /^image\//, fileReader; 474 | if (!defaultOp.cropperImage.data("cropper")) { 475 | return; 476 | } 477 | if (!imageType.test(fileOb.type)) { 478 | return; 479 | } 480 | 481 | fileReader = new FileReader(); 482 | fileReader.onload = function (event) { 483 | var theImgDataSrc = event.target.result, 484 | thisImageType, 485 | posof = theImgDataSrc.indexOf(";base64"); 486 | if (posof > -1) { 487 | thisImageType = theImgDataSrc.substring(0, posof); 488 | } else { 489 | thisImageType = "image/jpeg"; 490 | } 491 | resetCropper(false, theImgDataSrc); 492 | defaultOp.cropperImage.removeClass("not_active"); 493 | }; 494 | defaultOp.cropperImage.file = fileOb; 495 | defaultOp.cropperImage.file_name = makeRandom(); 496 | fileReader.readAsDataURL(fileOb); 497 | } 498 | 499 | $("#upload").click(function (e) { 500 | $("#upload_files_modal").modal("show"); 501 | }); 502 | 503 | $("#upload_files_modal") 504 | .on("shown.bs.modal", function () { 505 | resetCropper(null, defaultOp.placeHolderImageUrl); 506 | }) 507 | .on("hidden.bs.modal", function () { 508 | destroyCropper(); 509 | defaultOp.cropperImage.addClass("not_active"); 510 | }); 511 | 512 | $("#file_toupload").change(function (e) { 513 | renderImage(this.files[0]); 514 | }); 515 | $(".aspect-ratio-btn-group").on("click", ".btn", function (e) { 516 | if ( 517 | !defaultOp.cropperImage.data("cropper") || 518 | defaultOp.cropperImage.hasClass("not_active") 519 | ) { 520 | return; 521 | } 522 | $(".aspect-ratio-btn-group .btn").prop("disabled", false); 523 | $(this).prop("disabled", true); 524 | let ratio = $(this).data("ratio"); 525 | if (ratio === 1) { 526 | $("#devices-checkbox-group .device-checkbox").prop( 527 | "checked", 528 | false 529 | ); 530 | $("#device-thumb").prop("disabled", false).prop("checked", true); 531 | } else { 532 | $("#device-thumb").prop("disabled", true).prop("checked", false); 533 | } 534 | resetCropper(ratio); 535 | }); 536 | 537 | $("#submit_image").on("click", function (e) { 538 | let devicesVersion = [], 539 | formData, 540 | checkboxCheckeds = $("#devices-checkbox-group .device-checkbox:checked"); 541 | if ( 542 | !defaultOp.cropperImage.data("cropper") || 543 | defaultOp.cropperImage.hasClass("not_active") || 544 | !defaultOp.cropperImage.file 545 | ) { 546 | return false; 547 | } 548 | 549 | if (checkboxCheckeds.length > 0) { 550 | let checkboxCheckedCount = checkboxCheckeds.length; 551 | for (let i = 0; i < checkboxCheckedCount; i++) { 552 | devicesVersion.push($(checkboxCheckeds[i]).val()); 553 | } 554 | } 555 | if (!devicesVersion.length) { 556 | return false; 557 | } 558 | 559 | formData = new FormData(); 560 | 561 | formData.append("upload_path", vm.curRelativePath); 562 | formData.append("image_quality", $("#image_quality").val()); 563 | formData.append("devices_version", JSON.stringify(devicesVersion)); 564 | formData.append("_token", defaultOp.CSRF_TOKEN); 565 | 566 | if (defaultOp.cropperImage.file.type === "image/png") { 567 | formData.append("ext", ".png"); 568 | formData.append( 569 | "croppedImage", 570 | defaultOp.cropperImage 571 | .cropper("getCroppedCanvas") 572 | .toDataURL("image/png") 573 | ); 574 | } else { 575 | if (defaultOp.cropperImage.file.type === "image/gif") { 576 | formData.append("ext", ".gif"); 577 | formData.append( 578 | "croppedImage", 579 | defaultOp.cropperImage 580 | .cropper("getCroppedCanvas") 581 | .toDataURL("image/gif") 582 | ); 583 | } else { 584 | formData.append("ext", ".jpg"); 585 | formData.append( 586 | "croppedImage", 587 | defaultOp.cropperImage 588 | .cropper("getCroppedCanvas") 589 | .toDataURL("image/jpeg") 590 | ); 591 | } 592 | } 593 | formData.append("file_name", defaultOp.cropperImage.file_name); 594 | $.ajax({ 595 | url: defaultOp.baseUrl + "/imagemanager/upload_cropped", 596 | type: "POST", 597 | data: formData, 598 | contentType: false, 599 | cache: false, 600 | processData: false, 601 | beforeSend: function () { 602 | $("#submit_image").prop("disabled", true); 603 | }, 604 | xhr: function () { 605 | let xhr = $.ajaxSettings.xhr(); 606 | if (xhr.upload) { 607 | xhr.upload.addEventListener( 608 | "progress", 609 | function (event) { 610 | let percent = 0, 611 | position = event.loaded || event.position, 612 | total = event.total; 613 | 614 | if (event.lengthComputable) { 615 | percent = Math.ceil(position / total * 100); 616 | } 617 | 618 | $("#progress-wrp-row").fadeIn(); 619 | $("#progress-wrp .progress-bar").css( 620 | "width", 621 | +percent + "%" 622 | ); 623 | $("#progress-wrp " + " .status").text( 624 | percent + "%" 625 | ); 626 | }, 627 | true 628 | ); 629 | } 630 | return xhr; 631 | }, 632 | mimeType: "multipart/form-data", 633 | error: function () { 634 | toastr.error("Upload error", "Whoopsie!"); 635 | }, 636 | success: function () { 637 | toastr.success("Upload success", "Sweet Success!"); 638 | vm.loadItems(); 639 | }, 640 | complete: function () { 641 | $("#submit_image").prop("disabled", false); 642 | $("#progress-wrp-row").fadeOut(); 643 | } 644 | }); 645 | }); 646 | 647 | function bytesToSize(bytes) { 648 | let sizes = ["Bytes", "KB", "MB", "GB", "TB"], i; 649 | if (bytes === 0) { 650 | return "0 Bytes"; 651 | } 652 | i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10); 653 | return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i]; 654 | } 655 | } 656 | 657 | $(document).ready(function () { 658 | imageManager(); 659 | }); 660 | -------------------------------------------------------------------------------- /publishable/assets/lib/js/cropper.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Cropper v2.3.4 3 | * https://github.com/fengyuanchen/cropper 4 | * 5 | * Copyright (c) 2014-2016 Fengyuan Chen and contributors 6 | * Released under the MIT license 7 | * 8 | * Date: 2016-09-03T05:50:45.412Z 9 | */ 10 | !function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){"use strict";function i(t){return"number"==typeof t&&!isNaN(t)}function e(t){return"undefined"==typeof t}function s(t,e){var s=[];return i(e)&&s.push(e),s.slice.apply(t,s)}function a(t,i){var e=s(arguments,2);return function(){return t.apply(i,e.concat(s(arguments)))}}function o(t){var i=t.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return i&&(i[1]!==C.protocol||i[2]!==C.hostname||i[3]!==C.port)}function h(t){var i="timestamp="+(new Date).getTime();return t+(t.indexOf("?")===-1?"?":"&")+i}function n(t){return t?' crossOrigin="'+t+'"':""}function r(t,i){var e;return t.naturalWidth&&!mt?i(t.naturalWidth,t.naturalHeight):(e=document.createElement("img"),e.onload=function(){i(this.width,this.height)},void(e.src=t.src))}function p(t){var e=[],s=t.rotate,a=t.scaleX,o=t.scaleY;return i(s)&&0!==s&&e.push("rotate("+s+"deg)"),i(a)&&1!==a&&e.push("scaleX("+a+")"),i(o)&&1!==o&&e.push("scaleY("+o+")"),e.length?e.join(" "):"none"}function l(t,i){var e,s,a=Ct(t.degree)%180,o=(a>90?180-a:a)*Math.PI/180,h=bt(o),n=Bt(o),r=t.width,p=t.height,l=t.aspectRatio;return i?(e=r/(n+h/l),s=e/l):(e=r*n+p*h,s=r*h+p*n),{width:e,height:s}}function c(e,s){var a,o,h,n=t("")[0],r=n.getContext("2d"),p=0,c=0,d=s.naturalWidth,g=s.naturalHeight,u=s.rotate,f=s.scaleX,m=s.scaleY,v=i(f)&&i(m)&&(1!==f||1!==m),w=i(u)&&0!==u,x=w||v,C=d*Ct(f||1),b=g*Ct(m||1);return v&&(a=C/2,o=b/2),w&&(h=l({width:C,height:b,degree:u}),C=h.width,b=h.height,a=C/2,o=b/2),n.width=C,n.height=b,x&&(p=-d/2,c=-g/2,r.save(),r.translate(a,o)),w&&r.rotate(u*Math.PI/180),v&&r.scale(f,m),r.drawImage(e,$t(p),$t(c),$t(d),$t(g)),x&&r.restore(),n}function d(i){var e=i.length,s=0,a=0;return e&&(t.each(i,function(t,i){s+=i.pageX,a+=i.pageY}),s/=e,a/=e),{pageX:s,pageY:a}}function g(t,i,e){var s,a="";for(s=i,e+=i;s=8&&(r=s+a)))),r)for(d=c.getUint16(r,o),l=0;l")[0].getContext),mt=b&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(b.userAgent),vt=Number,wt=Math.min,xt=Math.max,Ct=Math.abs,bt=Math.sin,Bt=Math.cos,yt=Math.sqrt,Dt=Math.round,$t=Math.floor,Lt=String.fromCharCode;v.prototype={constructor:v,init:function(){var t,i=this.$element;if(i.is("img")){if(this.isImg=!0,this.originalUrl=t=i.attr("src"),!t)return;t=i.prop("src")}else i.is("canvas")&&ft&&(t=i[0].toDataURL());this.load(t)},trigger:function(i,e){var s=t.Event(i,e);return this.$element.trigger(s),s},load:function(i){var e,s,a=this.options,n=this.$element;if(i&&(n.one(A,a.build),!this.trigger(A).isDefaultPrevented())){if(this.url=i,this.image={},!a.checkOrientation||!B)return this.clone();if(e=t.proxy(this.read,this),V.test(i))return J.test(i)?e(f(i)):this.clone();s=new XMLHttpRequest,s.onerror=s.onabort=t.proxy(function(){this.clone()},this),s.onload=function(){e(this.response)},a.checkCrossOrigin&&o(i)&&n.prop("crossOrigin")&&(i=h(i)),s.open("get",i),s.responseType="arraybuffer",s.send()}},read:function(t){var i=this.options,e=u(t),s=this.image,a=0,o=1,h=1;if(e>1)switch(this.url=m(t),e){case 2:o=-1;break;case 3:a=-180;break;case 4:h=-1;break;case 5:a=90,h=-1;break;case 6:a=90;break;case 7:a=90,o=-1;break;case 8:a=-90}i.rotatable&&(s.rotate=a),i.scalable&&(s.scaleX=o,s.scaleY=h),this.clone()},clone:function(){var i,e,s=this.options,a=this.$element,r=this.url,p="";s.checkCrossOrigin&&o(r)&&(p=a.prop("crossOrigin"),p?i=r:(p="anonymous",i=h(r))),this.crossOrigin=p,this.crossOriginUrl=i,this.$clone=e=t("'),this.isImg?a[0].complete?this.start():a.one(I,t.proxy(this.start,this)):e.one(I,t.proxy(this.start,this)).one(F,t.proxy(this.stop,this)).addClass(X).insertAfter(a)},start:function(){var i=this.$element,e=this.$clone;this.isImg||(e.off(F,this.stop),i=e),r(i[0],t.proxy(function(i,e){t.extend(this.image,{naturalWidth:i,naturalHeight:e,aspectRatio:i/e}),this.isLoaded=!0,this.build()},this))},stop:function(){this.$clone.remove(),this.$clone=null},build:function(){var i,e,s,a=this.options,o=this.$element,h=this.$clone;this.isLoaded&&(this.isBuilt&&this.unbuild(),this.$container=o.parent(),this.$cropper=i=t(v.TEMPLATE),this.$canvas=i.find(".cropper-canvas").append(h),this.$dragBox=i.find(".cropper-drag-box"),this.$cropBox=e=i.find(".cropper-crop-box"),this.$viewBox=i.find(".cropper-view-box"),this.$face=s=e.find(".cropper-face"),o.addClass(Y).after(i),this.isImg||h.removeClass(X),this.initPreview(),this.bind(),a.aspectRatio=xt(0,a.aspectRatio)||NaN,a.viewMode=xt(0,wt(3,Dt(a.viewMode)))||0,a.autoCrop?(this.isCropped=!0,a.modal&&this.$dragBox.addClass(T)):e.addClass(Y),a.guides||e.find(".cropper-dashed").addClass(Y),a.center||e.find(".cropper-center").addClass(Y),a.cropBoxMovable&&s.addClass(M).data(it,lt),a.highlight||s.addClass(k),a.background&&i.addClass(R),a.cropBoxResizable||e.find(".cropper-line, .cropper-point").addClass(Y),this.setDragMode(a.dragMode),this.render(),this.isBuilt=!0,this.setData(a.data),o.one(S,a.built),this.completing=setTimeout(t.proxy(function(){this.trigger(S),this.trigger(K,this.getData()),this.isCompleted=!0},this),0))},unbuild:function(){this.isBuilt&&(this.isCompleted||clearTimeout(this.completing),this.isBuilt=!1,this.isCompleted=!1,this.initialImage=null,this.initialCanvas=null,this.initialCropBox=null,this.container=null,this.canvas=null,this.cropBox=null,this.unbind(),this.resetPreview(),this.$preview=null,this.$viewBox=null,this.$cropBox=null,this.$dragBox=null,this.$canvas=null,this.$container=null,this.$cropper.remove(),this.$cropper=null)},render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.isCropped&&this.renderCropBox()},initContainer:function(){var t=this.options,i=this.$element,e=this.$container,s=this.$cropper;s.addClass(Y),i.removeClass(Y),s.css(this.container={width:xt(e.width(),vt(t.minContainerWidth)||200),height:xt(e.height(),vt(t.minContainerHeight)||100)}),i.addClass(Y),s.removeClass(Y)},initCanvas:function(){var i,e=this.options.viewMode,s=this.container,a=s.width,o=s.height,h=this.image,n=h.naturalWidth,r=h.naturalHeight,p=90===Ct(h.rotate),l=p?r:n,c=p?n:r,d=l/c,g=a,u=o;o*d>a?3===e?g=o*d:u=a/d:3===e?u=a/d:g=o*d,i={naturalWidth:l,naturalHeight:c,aspectRatio:d,width:g,height:u},i.oldLeft=i.left=(a-g)/2,i.oldTop=i.top=(o-u)/2,this.canvas=i,this.isLimited=1===e||2===e,this.limitCanvas(!0,!0),this.initialImage=t.extend({},h),this.initialCanvas=t.extend({},i)},limitCanvas:function(t,i){var e,s,a,o,h=this.options,n=h.viewMode,r=this.container,p=r.width,l=r.height,c=this.canvas,d=c.aspectRatio,g=this.cropBox,u=this.isCropped&&g;t&&(e=vt(h.minCanvasWidth)||0,s=vt(h.minCanvasHeight)||0,n&&(n>1?(e=xt(e,p),s=xt(s,l),3===n&&(s*d>e?e=s*d:s=e/d)):e?e=xt(e,u?g.width:0):s?s=xt(s,u?g.height:0):u&&(e=g.width,s=g.height,s*d>e?e=s*d:s=e/d)),e&&s?s*d>e?s=e/d:e=s*d:e?s=e/d:s&&(e=s*d),c.minWidth=e,c.minHeight=s,c.maxWidth=1/0,c.maxHeight=1/0),i&&(n?(a=p-c.width,o=l-c.height,c.minLeft=wt(0,a),c.minTop=wt(0,o),c.maxLeft=xt(0,a),c.maxTop=xt(0,o),u&&this.isLimited&&(c.minLeft=wt(g.left,g.left+g.width-c.width),c.minTop=wt(g.top,g.top+g.height-c.height),c.maxLeft=g.left,c.maxTop=g.top,2===n&&(c.width>=p&&(c.minLeft=wt(0,a),c.maxLeft=xt(0,a)),c.height>=l&&(c.minTop=wt(0,o),c.maxTop=xt(0,o))))):(c.minLeft=-c.width,c.minTop=-c.height,c.maxLeft=p,c.maxTop=l))},renderCanvas:function(t){var i,e,s=this.canvas,a=this.image,o=a.rotate,h=a.naturalWidth,n=a.naturalHeight;this.isRotated&&(this.isRotated=!1,e=l({width:a.width,height:a.height,degree:o}),i=e.width/e.height,i!==s.aspectRatio&&(s.left-=(e.width-s.width)/2,s.top-=(e.height-s.height)/2,s.width=e.width,s.height=e.height,s.aspectRatio=i,s.naturalWidth=h,s.naturalHeight=n,o%180&&(e=l({width:h,height:n,degree:o}),s.naturalWidth=e.width,s.naturalHeight=e.height),this.limitCanvas(!0,!1))),(s.width>s.maxWidth||s.widths.maxHeight||s.heighte.width?o.height=o.width/s:o.width=o.height*s),this.cropBox=o,this.limitCropBox(!0,!0),o.width=wt(xt(o.width,o.minWidth),o.maxWidth),o.height=wt(xt(o.height,o.minHeight),o.maxHeight),o.width=xt(o.minWidth,o.width*a),o.height=xt(o.minHeight,o.height*a),o.oldLeft=o.left=e.left+(e.width-o.width)/2,o.oldTop=o.top=e.top+(e.height-o.height)/2,this.initialCropBox=t.extend({},o)},limitCropBox:function(t,i){var e,s,a,o,h=this.options,n=h.aspectRatio,r=this.container,p=r.width,l=r.height,c=this.canvas,d=this.cropBox,g=this.isLimited;t&&(e=vt(h.minCropBoxWidth)||0,s=vt(h.minCropBoxHeight)||0,e=wt(e,p),s=wt(s,l),a=wt(p,g?c.width:p),o=wt(l,g?c.height:l),n&&(e&&s?s*n>e?s=e/n:e=s*n:e?s=e/n:s&&(e=s*n),o*n>a?o=a/n:a=o*n),d.minWidth=wt(e,a),d.minHeight=wt(s,o),d.maxWidth=a,d.maxHeight=o),i&&(g?(d.minLeft=xt(0,c.left),d.minTop=xt(0,c.top),d.maxLeft=wt(p,c.left+c.width)-d.width,d.maxTop=wt(l,c.top+c.height)-d.height):(d.minLeft=0,d.minTop=0,d.maxLeft=p-d.width,d.maxTop=l-d.height))},renderCropBox:function(){var t=this.options,i=this.container,e=i.width,s=i.height,a=this.cropBox;(a.width>a.maxWidth||a.widtha.maxHeight||a.height'),this.$viewBox.html(i),this.$preview.each(function(){var i=t(this);i.data(tt,{width:i.width(),height:i.height(),html:i.html()}),i.html("')})},resetPreview:function(){this.$preview.each(function(){var i=t(this),e=i.data(tt);i.css({width:e.width,height:e.height}).html(e.html).removeData(tt)})},preview:function(){var i=this.image,e=this.canvas,s=this.cropBox,a=s.width,o=s.height,h=i.width,n=i.height,r=s.left-e.left-i.left,l=s.top-e.top-i.top;this.isCropped&&!this.isDisabled&&(this.$clone2.css({width:h,height:n,marginLeft:-r,marginTop:-l,transform:p(i)}),this.$preview.each(function(){var e=t(this),s=e.data(tt),c=s.width,d=s.height,g=c,u=d,f=1;a&&(f=c/a,u=o*f),o&&u>d&&(f=d/o,g=a*f,u=d),e.css({width:g,height:u}).find("img").css({width:h*f,height:n*f,marginLeft:-r*f,marginTop:-l*f,transform:p(i)})}))},bind:function(){var i=this.options,e=this.$element,s=this.$cropper;t.isFunction(i.cropstart)&&e.on(N,i.cropstart),t.isFunction(i.cropmove)&&e.on(_,i.cropmove),t.isFunction(i.cropend)&&e.on(q,i.cropend),t.isFunction(i.crop)&&e.on(K,i.crop),t.isFunction(i.zoom)&&e.on(Z,i.zoom),s.on(z,t.proxy(this.cropStart,this)),i.zoomable&&i.zoomOnWheel&&s.on(E,t.proxy(this.wheel,this)),i.toggleDragModeOnDblclick&&s.on(U,t.proxy(this.dblclick,this)),x.on(O,this._cropMove=a(this.cropMove,this)).on(P,this._cropEnd=a(this.cropEnd,this)),i.responsive&&w.on(j,this._resize=a(this.resize,this))},unbind:function(){var i=this.options,e=this.$element,s=this.$cropper;t.isFunction(i.cropstart)&&e.off(N,i.cropstart),t.isFunction(i.cropmove)&&e.off(_,i.cropmove),t.isFunction(i.cropend)&&e.off(q,i.cropend),t.isFunction(i.crop)&&e.off(K,i.crop),t.isFunction(i.zoom)&&e.off(Z,i.zoom),s.off(z,this.cropStart),i.zoomable&&i.zoomOnWheel&&s.off(E,this.wheel),i.toggleDragModeOnDblclick&&s.off(U,this.dblclick),x.off(O,this._cropMove).off(P,this._cropEnd),i.responsive&&w.off(j,this._resize)},resize:function(){var i,e,s,a=this.options.restore,o=this.$container,h=this.container;!this.isDisabled&&h&&(s=o.width()/h.width,1===s&&o.height()===h.height||(a&&(i=this.getCanvasData(),e=this.getCropBoxData()),this.render(),a&&(this.setCanvasData(t.each(i,function(t,e){i[t]=e*s})),this.setCropBoxData(t.each(e,function(t,i){e[t]=i*s})))))},dblclick:function(){this.isDisabled||(this.$dragBox.hasClass(W)?this.setDragMode(dt):this.setDragMode(ct))},wheel:function(i){var e=i.originalEvent||i,s=vt(this.options.wheelZoomRatio)||.1,a=1;this.isDisabled||(i.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(t.proxy(function(){this.wheeling=!1},this),50),e.deltaY?a=e.deltaY>0?1:-1:e.wheelDelta?a=-e.wheelDelta/120:e.detail&&(a=e.detail>0?1:-1),this.zoom(-a*s,i)))},cropStart:function(i){var e,s,a=this.options,o=i.originalEvent,h=o&&o.touches,n=i;if(!this.isDisabled){if(h){if(e=h.length,e>1){if(!a.zoomable||!a.zoomOnTouch||2!==e)return;n=h[1],this.startX2=n.pageX,this.startY2=n.pageY,s=gt}n=h[0]}if(s=s||t(n.target).data(it),Q.test(s)){if(this.trigger(N,{originalEvent:o,action:s}).isDefaultPrevented())return;i.preventDefault(),this.action=s,this.cropping=!1,this.startX=n.pageX||o&&o.pageX,this.startY=n.pageY||o&&o.pageY,s===ct&&(this.cropping=!0,this.$dragBox.addClass(T))}}},cropMove:function(t){var i,e=this.options,s=t.originalEvent,a=s&&s.touches,o=t,h=this.action;if(!this.isDisabled){if(a){if(i=a.length,i>1){if(!e.zoomable||!e.zoomOnTouch||2!==i)return;o=a[1],this.endX2=o.pageX,this.endY2=o.pageY}o=a[0]}if(h){if(this.trigger(_,{originalEvent:s,action:h}).isDefaultPrevented())return;t.preventDefault(),this.endX=o.pageX||s&&s.pageX,this.endY=o.pageY||s&&s.pageY,this.change(o.shiftKey,h===gt?t:null)}}},cropEnd:function(t){var i=t.originalEvent,e=this.action;this.isDisabled||e&&(t.preventDefault(),this.cropping&&(this.cropping=!1,this.$dragBox.toggleClass(T,this.isCropped&&this.options.modal)),this.action="",this.trigger(q,{originalEvent:i,action:e}))},change:function(t,i){var e,s,a=this.options,o=a.aspectRatio,h=this.action,n=this.container,r=this.canvas,p=this.cropBox,l=p.width,c=p.height,d=p.left,g=p.top,u=d+l,f=g+c,m=0,v=0,w=n.width,x=n.height,C=!0;switch(!o&&t&&(o=l&&c?l/c:1),this.isLimited&&(m=p.minLeft,v=p.minTop,w=m+wt(n.width,r.width,r.left+r.width),x=v+wt(n.height,r.height,r.top+r.height)),s={x:this.endX-this.startX,y:this.endY-this.startY},o&&(s.X=s.y*o,s.Y=s.x/o),h){case lt:d+=s.x,g+=s.y;break;case et:if(s.x>=0&&(u>=w||o&&(g<=v||f>=x))){C=!1;break}l+=s.x,o&&(c=l/o,g-=s.Y/2),l<0&&(h=st,l=0);break;case ot:if(s.y<=0&&(g<=v||o&&(d<=m||u>=w))){C=!1;break}c-=s.y,g+=s.y,o&&(l=c*o,d+=s.X/2),c<0&&(h=at,c=0);break;case st:if(s.x<=0&&(d<=m||o&&(g<=v||f>=x))){C=!1;break}l-=s.x,d+=s.x,o&&(c=l/o,g+=s.Y/2),l<0&&(h=et,l=0);break;case at:if(s.y>=0&&(f>=x||o&&(d<=m||u>=w))){C=!1;break}c+=s.y,o&&(l=c*o,d-=s.X/2),c<0&&(h=ot,c=0);break;case rt:if(o){if(s.y<=0&&(g<=v||u>=w)){C=!1;break}c-=s.y,g+=s.y,l=c*o}else s.x>=0?uv&&(c-=s.y,g+=s.y):(c-=s.y,g+=s.y);l<0&&c<0?(h=nt,c=0,l=0):l<0?(h=pt,l=0):c<0&&(h=ht,c=0);break;case pt:if(o){if(s.y<=0&&(g<=v||d<=m)){C=!1;break}c-=s.y,g+=s.y,l=c*o,d+=s.X}else s.x<=0?d>m?(l-=s.x,d+=s.x):s.y<=0&&g<=v&&(C=!1):(l-=s.x,d+=s.x),s.y<=0?g>v&&(c-=s.y,g+=s.y):(c-=s.y,g+=s.y);l<0&&c<0?(h=ht,c=0,l=0):l<0?(h=rt,l=0):c<0&&(h=nt,c=0);break;case nt:if(o){if(s.x<=0&&(d<=m||f>=x)){C=!1;break}l-=s.x,d+=s.x,c=l/o}else s.x<=0?d>m?(l-=s.x,d+=s.x):s.y>=0&&f>=x&&(C=!1):(l-=s.x,d+=s.x),s.y>=0?f=0&&(u>=w||f>=x)){C=!1;break}l+=s.x,c=l/o}else s.x>=0?u=0&&f>=x&&(C=!1):l+=s.x,s.y>=0?f0?h=s.y>0?ht:rt:s.x<0&&(d-=l,h=s.y>0?nt:pt),s.y<0&&(g-=c),this.isCropped||(this.$cropBox.removeClass(Y),this.isCropped=!0,this.isLimited&&this.limitCropBox(!0,!0))}C&&(p.width=l,p.height=c,p.left=d,p.top=g,this.action=h,this.renderCropBox()),this.startX=this.endX,this.startY=this.endY},crop:function(){this.isBuilt&&!this.isDisabled&&(this.isCropped||(this.isCropped=!0,this.limitCropBox(!0,!0),this.options.modal&&this.$dragBox.addClass(T),this.$cropBox.removeClass(Y)),this.setCropBoxData(this.initialCropBox))},reset:function(){this.isBuilt&&!this.isDisabled&&(this.image=t.extend({},this.initialImage),this.canvas=t.extend({},this.initialCanvas),this.cropBox=t.extend({},this.initialCropBox),this.renderCanvas(),this.isCropped&&this.renderCropBox())},clear:function(){this.isCropped&&!this.isDisabled&&(t.extend(this.cropBox,{left:0,top:0,width:0,height:0}),this.isCropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),this.$dragBox.removeClass(T),this.$cropBox.addClass(Y))},replace:function(t,i){!this.isDisabled&&t&&(this.isImg&&this.$element.attr("src",t),i?(this.url=t,this.$clone.attr("src",t),this.isBuilt&&this.$preview.find("img").add(this.$clone2).attr("src",t)):(this.isImg&&(this.isReplaced=!0),this.options.data=null,this.load(t)))},enable:function(){this.isBuilt&&(this.isDisabled=!1,this.$cropper.removeClass(H))},disable:function(){this.isBuilt&&(this.isDisabled=!0,this.$cropper.addClass(H))},destroy:function(){var t=this.$element;this.isLoaded?(this.isImg&&this.isReplaced&&t.attr("src",this.originalUrl),this.unbuild(),t.removeClass(Y)):this.isImg?t.off(I,this.start):this.$clone&&this.$clone.remove(),t.removeData(L)},move:function(t,i){var s=this.canvas;this.moveTo(e(t)?t:s.left+vt(t),e(i)?i:s.top+vt(i))},moveTo:function(t,s){var a=this.canvas,o=!1;e(s)&&(s=t),t=vt(t),s=vt(s),this.isBuilt&&!this.isDisabled&&this.options.movable&&(i(t)&&(a.left=t,o=!0),i(s)&&(a.top=s,o=!0),o&&this.renderCanvas(!0))},zoom:function(t,i){var e=this.canvas;t=vt(t),t=t<0?1/(1-t):1+t,this.zoomTo(e.width*t/e.naturalWidth,i)},zoomTo:function(t,i){var e,s,a,o,h,n=this.options,r=this.canvas,p=r.width,l=r.height,c=r.naturalWidth,g=r.naturalHeight;if(t=vt(t),t>=0&&this.isBuilt&&!this.isDisabled&&n.zoomable){if(s=c*t,a=g*t,i&&(e=i.originalEvent),this.trigger(Z,{originalEvent:e,oldRatio:p/c,ratio:s/c}).isDefaultPrevented())return;e?(o=this.$cropper.offset(),h=e.touches?d(e.touches):{pageX:i.pageX||e.pageX||0,pageY:i.pageY||e.pageY||0},r.left-=(s-p)*((h.pageX-o.left-r.left)/p),r.top-=(a-l)*((h.pageY-o.top-r.top)/l)):(r.left-=(s-p)/2,r.top-=(a-l)/2),r.width=s,r.height=a,this.renderCanvas(!0)}},rotate:function(t){this.rotateTo((this.image.rotate||0)+vt(t))},rotateTo:function(t){t=vt(t),i(t)&&this.isBuilt&&!this.isDisabled&&this.options.rotatable&&(this.image.rotate=t%360,this.isRotated=!0,this.renderCanvas(!0))},scale:function(t,s){var a=this.image,o=!1;e(s)&&(s=t),t=vt(t),s=vt(s),this.isBuilt&&!this.isDisabled&&this.options.scalable&&(i(t)&&(a.scaleX=t,o=!0),i(s)&&(a.scaleY=s,o=!0),o&&this.renderImage(!0))},scaleX:function(t){var e=this.image.scaleY;this.scale(t,i(e)?e:1)},scaleY:function(t){var e=this.image.scaleX;this.scale(i(e)?e:1,t)},getData:function(i){var e,s,a=this.options,o=this.image,h=this.canvas,n=this.cropBox;return this.isBuilt&&this.isCropped?(s={x:n.left-h.left,y:n.top-h.top,width:n.width,height:n.height},e=o.width/o.naturalWidth,t.each(s,function(t,a){a/=e,s[t]=i?Dt(a):a})):s={x:0,y:0,width:0,height:0},a.rotatable&&(s.rotate=o.rotate||0),a.scalable&&(s.scaleX=o.scaleX||1,s.scaleY=o.scaleY||1),s},setData:function(e){var s,a,o,h=this.options,n=this.image,r=this.canvas,p={};t.isFunction(e)&&(e=e.call(this.element)),this.isBuilt&&!this.isDisabled&&t.isPlainObject(e)&&(h.rotatable&&i(e.rotate)&&e.rotate!==n.rotate&&(n.rotate=e.rotate,this.isRotated=s=!0),h.scalable&&(i(e.scaleX)&&e.scaleX!==n.scaleX&&(n.scaleX=e.scaleX,a=!0),i(e.scaleY)&&e.scaleY!==n.scaleY&&(n.scaleY=e.scaleY,a=!0)),s?this.renderCanvas():a&&this.renderImage(),o=n.width/n.naturalWidth,i(e.x)&&(p.left=e.x*o+r.left),i(e.y)&&(p.top=e.y*o+r.top),i(e.width)&&(p.width=e.width*o),i(e.height)&&(p.height=e.height*o),this.setCropBoxData(p))},getContainerData:function(){return this.isBuilt?this.container:{}},getImageData:function(){return this.isLoaded?this.image:{}},getCanvasData:function(){var i=this.canvas,e={};return this.isBuilt&&t.each(["left","top","width","height","naturalWidth","naturalHeight"],function(t,s){e[s]=i[s]}),e},setCanvasData:function(e){var s=this.canvas,a=s.aspectRatio;t.isFunction(e)&&(e=e.call(this.$element)),this.isBuilt&&!this.isDisabled&&t.isPlainObject(e)&&(i(e.left)&&(s.left=e.left),i(e.top)&&(s.top=e.top),i(e.width)?(s.width=e.width,s.height=e.width/a):i(e.height)&&(s.height=e.height,s.width=e.height*a),this.renderCanvas(!0))},getCropBoxData:function(){var t,i=this.cropBox;return this.isBuilt&&this.isCropped&&(t={left:i.left,top:i.top,width:i.width,height:i.height}),t||{}},setCropBoxData:function(e){var s,a,o=this.cropBox,h=this.options.aspectRatio;t.isFunction(e)&&(e=e.call(this.$element)),this.isBuilt&&this.isCropped&&!this.isDisabled&&t.isPlainObject(e)&&(i(e.left)&&(o.left=e.left),i(e.top)&&(o.top=e.top),i(e.width)&&(s=!0,o.width=e.width),i(e.height)&&(a=!0,o.height=e.height),h&&(s?o.height=o.width/h:a&&(o.width=o.height*h)),this.renderCropBox())},getCroppedCanvas:function(i){var e,s,a,o,h,n,r,p,l,d,g;if(this.isBuilt&&ft)return this.isCropped?(t.isPlainObject(i)||(i={}),g=this.getData(),e=g.width,s=g.height,p=e/s,t.isPlainObject(i)&&(h=i.width,n=i.height,h?(n=h/p,r=h/e):n&&(h=n*p,r=n/s)),a=$t(h||e),o=$t(n||s),l=t("")[0],l.width=a,l.height=o,d=l.getContext("2d"),i.fillColor&&(d.fillStyle=i.fillColor,d.fillRect(0,0,a,o)),d.drawImage.apply(d,function(){var t,i,a,o,h,n,p=c(this.$clone[0],this.image),l=p.width,d=p.height,u=this.canvas,f=[p],m=g.x+u.naturalWidth*(Ct(g.scaleX||1)-1)/2,v=g.y+u.naturalHeight*(Ct(g.scaleY||1)-1)/2;return m<=-e||m>l?m=t=a=h=0:m<=0?(a=-m,m=0,t=h=wt(l,e+m)):m<=l&&(a=0,t=h=wt(e,l-m)),t<=0||v<=-s||v>d?v=i=o=n=0:v<=0?(o=-v,v=0,i=n=wt(d,s+v)):v<=d&&(o=0,i=n=wt(s,d-v)),f.push($t(m),$t(v),$t(t),$t(i)),r&&(a*=r,o*=r,h*=r,n*=r),h>0&&n>0&&f.push($t(a),$t(o),$t(h),$t(n)),f}.call(this)),l):c(this.$clone[0],this.image)},setAspectRatio:function(t){var i=this.options;this.isDisabled||e(t)||(i.aspectRatio=xt(0,t)||NaN,this.isBuilt&&(this.initCropBox(),this.isCropped&&this.renderCropBox()))},setDragMode:function(t){var i,e,s=this.options;this.isLoaded&&!this.isDisabled&&(i=t===ct,e=s.movable&&t===dt,t=i||e?t:ut,this.$dragBox.data(it,t).toggleClass(W,i).toggleClass(M,e),s.cropBoxMovable||this.$face.data(it,t).toggleClass(W,i).toggleClass(M,e))}},v.DEFAULTS={viewMode:0,dragMode:"crop",aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,build:null,built:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},v.setDefaults=function(i){t.extend(v.DEFAULTS,i)},v.TEMPLATE='
',v.other=t.fn.cropper,t.fn.cropper=function(i){var a,o=s(arguments,1);return this.each(function(){var e,s,h=t(this),n=h.data(L);if(!n){if(/destroy/.test(i))return;e=t.extend({},h.data(),t.isPlainObject(i)&&i),h.data(L,n=new v(this,e))}"string"==typeof i&&t.isFunction(s=n[i])&&(a=s.apply(n,o))}),e(a)?this:a},t.fn.cropper.Constructor=v,t.fn.cropper.setDefaults=v.setDefaults,t.fn.cropper.noConflict=function(){return t.fn.cropper=v.other,this}}); -------------------------------------------------------------------------------- /publishable/assets/lib/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.6 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under the MIT license 5 | */ 6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.6",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.6",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.6",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.6",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.6",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.6",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.6",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); --------------------------------------------------------------------------------