').addClass('mime-icon ico-' + item.icon));
+ }
+
+ carouselItem.find('.carousel-label').attr('target', '_blank').attr('href', item.url)
+ .append(item.name)
+ .append($('
'));
+
+ carousel.children('.carousel-inner').append(carouselItem);
+
+ var carouselIndicator = indicatorTemplate.clone()
+ .addClass(index === 0 ? 'active' : '')
+ .attr('data-slide-to', index);
+ carousel.children('.carousel-indicators').append(carouselIndicator);
+ });
+
+
+ // carousel swipe control
+ var touchStartX = null;
+
+ carousel.on('touchstart', function (event) {
+ var e = event.originalEvent;
+ if (e.touches.length == 1) {
+ var touch = e.touches[0];
+ touchStartX = touch.pageX;
+ }
+ }).on('touchmove', function (event) {
+ var e = event.originalEvent;
+ if (touchStartX != null) {
+ var touchCurrentX = e.changedTouches[0].pageX;
+ if ((touchCurrentX - touchStartX) > 60) {
+ touchStartX = null;
+ carousel.carousel('prev');
+ } else if ((touchStartX - touchCurrentX) > 60) {
+ touchStartX = null;
+ carousel.carousel('next');
+ }
+ }
+ }).on('touchend', function () {
+ touchStartX = null;
+ });
+ // end carousel swipe control
+
+ notify(carousel);
+}
+
+function move(items) {
+ performLfmRequest('move', { items: items.map(function (item) { return item.name; }) })
+ .done(refreshFoldersAndItems);
+}
+
+function getUrlParam(paramName) {
+ var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i');
+ var match = window.location.search.match(reParam);
+ return ( match && match.length > 1 ) ? match[1] : null;
+}
+
+function use(items) {
+ function useTinymce3(url) {
+ if (!usingTinymce3()) { return; }
+
+ var win = tinyMCEPopup.getWindowArg("window");
+ win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = url;
+ if (typeof(win.ImageDialog) != "undefined") {
+ // Update image dimensions
+ if (win.ImageDialog.getImageData) {
+ win.ImageDialog.getImageData();
+ }
+
+ // Preview if necessary
+ if (win.ImageDialog.showPreviewImage) {
+ win.ImageDialog.showPreviewImage(url);
+ }
+ }
+ tinyMCEPopup.close();
+ }
+
+ function useTinymce4AndColorbox(url) {
+ if (!usingTinymce4AndColorbox()) { return; }
+
+ parent.document.getElementById(getUrlParam('field_name')).value = url;
+
+ if(typeof parent.tinyMCE !== "undefined") {
+ parent.tinyMCE.activeEditor.windowManager.close();
+ }
+ if(typeof parent.$.fn.colorbox !== "undefined") {
+ parent.$.fn.colorbox.close();
+ }
+ }
+
+ function useTinymce5(url){
+ if (!usingTinymce5()) { return; }
+
+ parent.postMessage({
+ mceAction: 'insert',
+ content: url
+ });
+
+ parent.postMessage({ mceAction: 'close' });
+ }
+
+ function useCkeditor3(url) {
+ if (!usingCkeditor3()) { return; }
+
+ if (window.opener) {
+ // Popup
+ window.opener.CKEDITOR.tools.callFunction(getUrlParam('CKEditorFuncNum'), url);
+ } else {
+ // Modal (in iframe)
+ parent.CKEDITOR.tools.callFunction(getUrlParam('CKEditorFuncNum'), url);
+ parent.CKEDITOR.tools.callFunction(getUrlParam('CKEditorCleanUpFuncNum'));
+ }
+ }
+
+ function useFckeditor2(url) {
+ if (!usingFckeditor2()) { return; }
+
+ var p = url;
+ var w = data['Properties']['Width'];
+ var h = data['Properties']['Height'];
+ window.opener.SetUrl(p,w,h);
+ }
+
+ var url = items[0].url;
+ var callback = getUrlParam('callback');
+ var useFileSucceeded = true;
+
+ if (usingWysiwygEditor()) {
+ useTinymce3(url);
+
+ useTinymce4AndColorbox(url);
+
+ useTinymce5(url);
+
+ useCkeditor3(url);
+
+ useFckeditor2(url);
+ } else if (callback && window[callback]) {
+ window[callback](getSelectedItems());
+ } else if (callback && parent[callback]) {
+ parent[callback](getSelectedItems());
+ } else if (window.opener) { // standalone button or other situations
+ window.opener.SetUrl(getSelectedItems());
+ } else {
+ useFileSucceeded = false;
+ }
+
+ if (useFileSucceeded) {
+ if (window.opener) {
+ window.close();
+ }
+ } else {
+ console.log('window.opener not found');
+ // No editor found, open/download file using browser's default method
+ window.open(url);
+ }
+}
+//end useFile
+
+// ==================================
+// == WYSIWYG Editors Check ==
+// ==================================
+
+function usingTinymce3() {
+ return !!window.tinyMCEPopup;
+}
+
+function usingTinymce4AndColorbox() {
+ return !!getUrlParam('field_name');
+}
+
+function usingTinymce5(){
+ return !!getUrlParam('editor');
+}
+
+function usingCkeditor3() {
+ return !!getUrlParam('CKEditor') || !!getUrlParam('CKEditorCleanUpFuncNum');
+}
+
+function usingFckeditor2() {
+ return window.opener && typeof data != 'undefined' && data['Properties']['Width'] != '';
+}
+
+function usingWysiwygEditor() {
+ return usingTinymce3() || usingTinymce4AndColorbox() || usingTinymce5() || usingCkeditor3() || usingFckeditor2();
+}
+
+// ==================================
+// == Others ==
+// ==================================
+
+function defaultParameters() {
+ return {
+ working_dir: $('#working_dir').val(),
+ type: $('#type').val()
+ };
+}
+
+function notImp() {
+ notify('Not yet implemented!');
+}
+
+function notify(body, callback) {
+ $('#notify').find('.btn-primary').toggle(callback !== undefined);
+ $('#notify').find('.btn-primary').unbind().click(callback);
+ $('#notify').modal('show').find('.modal-body').html(body);
+}
+
+function dialog(title, value, callback) {
+ $('#dialog').find('input').val(value);
+ $('#dialog').on('shown.bs.modal', function () {
+ $('#dialog').find('input').focus();
+ });
+ $('#dialog').find('.btn-primary').unbind().click(function (e) {
+ callback($('#dialog').find('input').val());
+ });
+ $('#dialog').modal('show').find('.modal-title').text(title);
+}
diff --git a/public/vendor/laravel-filemanager/js/stand-alone-button.js b/public/vendor/laravel-filemanager/js/stand-alone-button.js
new file mode 100644
index 0000000..18dfa28
--- /dev/null
+++ b/public/vendor/laravel-filemanager/js/stand-alone-button.js
@@ -0,0 +1,36 @@
+(function( $ ){
+
+ $.fn.filemanager = function(type, options) {
+ type = type || 'file';
+
+ this.on('click', function(e) {
+ var route_prefix = (options && options.prefix) ? options.prefix : '/filemanager';
+ var target_input = $('#' + $(this).data('input'));
+ var target_preview = $('#' + $(this).data('preview'));
+ window.open(route_prefix + '?type=' + type, 'FileManager', 'width=900,height=600');
+ window.SetUrl = function (items) {
+ var file_path = items.map(function (item) {
+ return item.url;
+ }).join(',');
+
+ // set the value of the desired input to image url
+ target_input.val('').val(file_path).trigger('change');
+
+ // clear previous preview
+ target_preview.html('');
+
+ // set or change the preview image src
+ items.forEach(function (item) {
+ target_preview.append(
+ $('
![]()
').css('height', '5rem').attr('src', item.thumb_url)
+ );
+ });
+
+ // trigger change event
+ target_preview.trigger('change');
+ };
+ return false;
+ });
+ }
+
+})(jQuery);
diff --git a/routes/web.php b/routes/web.php
index 4816907..1e4d96f 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -12,5 +12,8 @@ Route::post('api/weibo/store', 'WeiboController@store');
Route::get('google/photo/connect', 'GooglePhotoController@connect');
Route::get('google/photo/index', 'GooglePhotoController@index');
Route::post("api/live/video/add", "LiveVideoController@add");
+Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'auth']], function () {
+ \UniSharp\LaravelFilemanager\Lfm::routes();
+});