Commit f9542144 by Bagus Pambudi

ganti bootstrap dan hapus vendor laravel filemgr

parent ab67900b
/*!
* Cropper v0.9.1
* https://github.com/fengyuanchen/cropper
*
* Copyright (c) 2014-2015 Fengyuan Chen and contributors
* Released under the MIT license
*
* Date: 2015-03-21T04:58:27.265Z
*/.cropper-container{position:relative;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}.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{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-drag-box{background-color:#fff;filter:alpha(opacity=0);opacity:0}.cropper-modal{background-color:#000;filter:alpha(opacity=50);opacity:.5}.cropper-view-box{display:block;width:100%;height:100%;overflow:hidden;outline:#69f solid 1px;outline-color:rgba(102,153,255,.75)}.cropper-dashed{position:absolute;display:block;filter:alpha(opacity=50);border:0 dashed #fff;opacity:.5}.cropper-dashed.dashed-h{top:33.33333333%;left:0;width:100%;height:33.33333333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333333%;width:33.33333333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;filter:alpha(opacity=10);opacity:.1}.cropper-face{top:0;left:0;cursor:move;background-color:#fff}.cropper-line{background-color:#69f}.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;background-color:#69f;filter:alpha(opacity=75);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;filter:alpha(opacity=100);opacity:1}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";background-color:#69f;filter:alpha(opacity=0);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;filter:alpha(opacity=75);opacity:.75}}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-invisible{filter:alpha(opacity=0);opacity:0}.cropper-hide{position:fixed;top:0;left:0;z-index:-1;width:auto!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;filter:alpha(opacity=0);opacity:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-canvas,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}
\ No newline at end of file
@-webkit-keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@-moz-keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@-webkit-keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@-moz-keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@-moz-keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}.dropzone,.dropzone *{box-sizing:border-box}.dropzone{min-height:150px;border:2px solid rgba(0,0,0,0.3);background:white;padding:20px 20px}.dropzone.dz-clickable{cursor:pointer}.dropzone.dz-clickable *{cursor:default}.dropzone.dz-clickable .dz-message,.dropzone.dz-clickable .dz-message *{cursor:pointer}.dropzone.dz-started .dz-message{display:none}.dropzone.dz-drag-hover{border-style:solid}.dropzone.dz-drag-hover .dz-message{opacity:0.5}.dropzone .dz-message{text-align:center;margin:2em 0}.dropzone .dz-preview{position:relative;display:inline-block;vertical-align:top;margin:16px;min-height:100px}.dropzone .dz-preview:hover{z-index:1000}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview.dz-file-preview .dz-image{border-radius:20px;background:#999;background:linear-gradient(to bottom, #eee, #ddd)}.dropzone .dz-preview.dz-file-preview .dz-details{opacity:1}.dropzone .dz-preview.dz-image-preview{background:white}.dropzone .dz-preview.dz-image-preview .dz-details{-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;-ms-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.dropzone .dz-preview .dz-remove{font-size:14px;text-align:center;display:block;cursor:pointer;border:none}.dropzone .dz-preview .dz-remove:hover{text-decoration:underline}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview .dz-details{z-index:20;position:absolute;top:0;left:0;opacity:0;font-size:13px;min-width:100%;max-width:100%;padding:2em 1em;text-align:center;color:rgba(0,0,0,0.9);line-height:150%}.dropzone .dz-preview .dz-details .dz-size{margin-bottom:1em;font-size:16px}.dropzone .dz-preview .dz-details .dz-filename{white-space:nowrap}.dropzone .dz-preview .dz-details .dz-filename:hover span{border:1px solid rgba(200,200,200,0.8);background-color:rgba(255,255,255,0.8)}.dropzone .dz-preview .dz-details .dz-filename:not(:hover){overflow:hidden;text-overflow:ellipsis}.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span{border:1px solid transparent}.dropzone .dz-preview .dz-details .dz-filename span,.dropzone .dz-preview .dz-details .dz-size span{background-color:rgba(255,255,255,0.4);padding:0 0.4em;border-radius:3px}.dropzone .dz-preview:hover .dz-image img{-webkit-transform:scale(1.05, 1.05);-moz-transform:scale(1.05, 1.05);-ms-transform:scale(1.05, 1.05);-o-transform:scale(1.05, 1.05);transform:scale(1.05, 1.05);-webkit-filter:blur(8px);filter:blur(8px)}.dropzone .dz-preview .dz-image{border-radius:20px;overflow:hidden;width:120px;height:120px;position:relative;display:block;z-index:10}.dropzone .dz-preview .dz-image img{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{-webkit-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-moz-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-ms-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-o-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview.dz-error .dz-error-mark{opacity:1;-webkit-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-moz-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-ms-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-o-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview .dz-success-mark,.dropzone .dz-preview .dz-error-mark{pointer-events:none;opacity:0;z-index:500;position:absolute;display:block;top:50%;left:50%;margin-left:-27px;margin-top:-27px}.dropzone .dz-preview .dz-success-mark svg,.dropzone .dz-preview .dz-error-mark svg{display:block;width:54px;height:54px}.dropzone .dz-preview.dz-processing .dz-progress{opacity:1;-webkit-transition:all 0.2s linear;-moz-transition:all 0.2s linear;-ms-transition:all 0.2s linear;-o-transition:all 0.2s linear;transition:all 0.2s linear}.dropzone .dz-preview.dz-complete .dz-progress{opacity:0;-webkit-transition:opacity 0.4s ease-in;-moz-transition:opacity 0.4s ease-in;-ms-transition:opacity 0.4s ease-in;-o-transition:opacity 0.4s ease-in;transition:opacity 0.4s ease-in}.dropzone .dz-preview:not(.dz-processing) .dz-progress{-webkit-animation:pulse 6s ease infinite;-moz-animation:pulse 6s ease infinite;-ms-animation:pulse 6s ease infinite;-o-animation:pulse 6s ease infinite;animation:pulse 6s ease infinite}.dropzone .dz-preview .dz-progress{opacity:1;z-index:1000;pointer-events:none;position:absolute;height:16px;left:50%;top:50%;margin-top:-8px;width:80px;margin-left:-40px;background:rgba(255,255,255,0.9);-webkit-transform:scale(1);border-radius:8px;overflow:hidden}.dropzone .dz-preview .dz-progress .dz-upload{background:#333;background:linear-gradient(to bottom, #666, #444);position:absolute;top:0;left:0;bottom:0;width:0;-webkit-transition:width 300ms ease-in-out;-moz-transition:width 300ms ease-in-out;-ms-transition:width 300ms ease-in-out;-o-transition:width 300ms ease-in-out;transition:width 300ms ease-in-out}.dropzone .dz-preview.dz-error .dz-error-message{display:block}.dropzone .dz-preview.dz-error:hover .dz-error-message{opacity:1;pointer-events:auto}.dropzone .dz-preview .dz-error-message{pointer-events:none;z-index:1000;position:absolute;display:block;display:none;opacity:0;-webkit-transition:opacity 0.3s ease;-moz-transition:opacity 0.3s ease;-ms-transition:opacity 0.3s ease;-o-transition:opacity 0.3s ease;transition:opacity 0.3s ease;border-radius:8px;font-size:13px;top:130px;left:-10px;width:140px;background:#be2626;background:linear-gradient(to bottom, #be2626, #a92222);padding:0.5em 1.2em;color:white}.dropzone .dz-preview .dz-error-message:after{content:'';position:absolute;top:-6px;left:64px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #be2626}
@media screen and (max-width: 768px) {
#main {
padding: 0px;
}
#nav {
margin-bottom: -1px;
}
#content > .row {
margin: 0px;
}
}
@media screen and (min-width: 768px) {
#main {
border-left: 1px solid silver;
}
}
#wrapper {
padding: 0px;
}
#wrapper > .panel {
border-radius: 0;
}
#wrapper > .panel > .panel-heading {
border-radius: 0;
}
#wrapper > .panel > .panel-heading > .panel-title {
padding: 10px 0;
}
#wrapper > .row {
margin: 0px;
}
#fab a:hover, #fab a:focus{
color: white;
}
.item_name {
width: 120px;
overflow:hidden;
white-space:nowrap;
text-overflow: ellipsis;
}
.clickable {
cursor: pointer;
}
.img-preview {
background-color: #f7f7f7;
overflow: hidden;
width: 100%;
text-align: center;
height: 200px;
}
.hidden {
display: none;
}
.square {
width: 100%;
padding-bottom: 100%;
position: relative;
border: 1px solid rgb(221, 221, 221);
border-radius: 3px;
// max-width: 210px;
max-height: 210px;
}
.visible-xs .square {
width: 60px;
}
.square > img {
padding: 5px;
position: absolute;
max-width: 100%;
max-height: 100%;
margin: 0 auto;
display: inline-block;
vertical-align: middle;
}
.square > i {
font-size: 80px;
padding: 5px;
position: absolute;
top: calc(50% - 40px);
left: calc(50% - 40px);
}
.visible-xs .square > i {
font-size: 50px;
padding: 0px auto;
padding-top: 5px;
top: calc(50% - 25px);
left: calc(50% - 25px);
}
.caption {
margin-top: 10px;
margin-bottom: 20px;
}
.caption > .btn-group {
width: 100%;
}
.caption > .btn-group > .item_name {
width: calc(100% - 25px);
}
.caption > .btn-group > .dropdown-toggle {
width: 25px;
}
#lfm-loader{
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: gray;
opacity: 0.7;
z-index: 9999;
text-align: center;
}
#lfm-loader:before {
content: "";
display: inline-block;
vertical-align: middle;
height: 100%;
}
#lfm-loader img{
width: 100px;
margin: 0 auto;
display: inline-block;
vertical-align: middle;
}
.table-list-view{
margin-bottom: 120px;
}
.table-list-view .actions{
text-align: right;
}
.table-list-view .actions a:hover{
text-decoration: none;
}
\ No newline at end of file
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="120" height="30" viewBox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="#fff">
<circle cx="15" cy="15" r="15">
<animate attributeName="r" from="15" to="15"
begin="0s" dur="0.8s"
values="15;9;15" calcMode="linear"
repeatCount="indefinite" />
<animate attributeName="fill-opacity" from="1" to="1"
begin="0s" dur="0.8s"
values="1;.5;1" calcMode="linear"
repeatCount="indefinite" />
</circle>
<circle cx="60" cy="15" r="9" fill-opacity="0.3">
<animate attributeName="r" from="9" to="9"
begin="0s" dur="0.8s"
values="9;15;9" calcMode="linear"
repeatCount="indefinite" />
<animate attributeName="fill-opacity" from="0.5" to="0.5"
begin="0s" dur="0.8s"
values=".5;1;.5" calcMode="linear"
repeatCount="indefinite" />
</circle>
<circle cx="105" cy="15" r="15">
<animate attributeName="r" from="15" to="15"
begin="0s" dur="0.8s"
values="15;9;15" calcMode="linear"
repeatCount="indefinite" />
<animate attributeName="fill-opacity" from="1" to="1"
begin="0s" dur="0.8s"
values="1;.5;1" calcMode="linear"
repeatCount="indefinite" />
</circle>
</svg>
(function( $ ){
$.fn.filemanager = function(type, options) {
type = type || 'file';
this.on('click', function(e) {
var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager';
localStorage.setItem('target_input', $(this).data('input'));
localStorage.setItem('target_preview', $(this).data('preview'));
window.open(route_prefix + '?type=' + type, 'FileManager', 'width=900,height=600');
window.SetUrl = function (url, file_path) {
//set the value of the desired input to image url
var target_input = $('#' + localStorage.getItem('target_input'));
target_input.val(file_path).trigger('change');
//set or change the preview image src
var target_preview = $('#' + localStorage.getItem('target_preview'));
target_preview.attr('src', url).trigger('change');
};
return false;
});
}
})(jQuery);
/**
* Material floating button
* By: Nobita
* Repo and docs: https://github.com/nobitagit/material-floating-button
*
* License: MIT
*/
// build script hook - don't remove
;(function ( window, document, undefined ) {
'use strict';
/**
* Some defaults
*/
var clickOpt = 'click',
hoverOpt = 'hover',
toggleMethod = 'data-mfb-toggle',
menuState = 'data-mfb-state',
isOpen = 'open',
isClosed = 'closed',
mainButtonClass = 'mfb-component__button--main';
/**
* Internal references
*/
var elemsToClick,
elemsToHover,
mainButton,
target,
currentState;
/**
* For every menu we need to get the main button and attach the appropriate evt.
*/
function attachEvt( elems, evt ){
for( var i = 0, len = elems.length; i < len; i++ ){
mainButton = elems[i].querySelector('.' + mainButtonClass);
mainButton.addEventListener( evt , toggleButton, false);
}
}
/**
* Remove the hover option, set a click toggle and a default,
* initial state of 'closed' to menu that's been targeted.
*/
function replaceAttrs( elems ){
for( var i = 0, len = elems.length; i < len; i++ ){
elems[i].setAttribute( toggleMethod, clickOpt );
elems[i].setAttribute( menuState, isClosed );
}
}
function getElemsByToggleMethod( selector ){
return document.querySelectorAll('[' + toggleMethod + '="' + selector + '"]');
}
/**
* The open/close action is performed by toggling an attribute
* on the menu main element.
*
* First, check if the target is the menu itself. If it's a child
* keep walking up the tree until we found the main element
* where we can toggle the state.
*/
function toggleButton( evt ){
target = evt.target;
while ( target && !target.getAttribute( toggleMethod ) ){
target = target.parentNode;
if(!target) { return; }
}
currentState = target.getAttribute( menuState ) === isOpen ? isClosed : isOpen;
target.setAttribute(menuState, currentState);
}
/**
* On touch enabled devices we assume that no hover state is possible.
* So, we get the menu with hover action configured and we set it up
* in order to make it usable with tap/click.
**/
if ( window.Modernizr && Modernizr.touch ){
elemsToHover = getElemsByToggleMethod( hoverOpt );
replaceAttrs( elemsToHover );
}
elemsToClick = getElemsByToggleMethod( clickOpt );
attachEvt( elemsToClick, 'click' );
// build script hook - don't remove
})( window, document );
var show_list;
var sort_type = 'alphabetic';
$(document).ready(function () {
bootbox.setDefaults({locale:lang['locale-bootbox']});
loadFolders();
performLfmRequest('errors')
.done(function (data) {
var response = JSON.parse(data);
for (var i = 0; i < response.length; i++) {
$('#alerts').append(
$('<div>').addClass('alert alert-warning')
.append($('<i>').addClass('fa fa-exclamation-circle'))
.append(' ' + response[i])
);
}
});
$(window).on('dragenter', function(){
$('#uploadModal').modal('show');
});
});
// ======================
// == Navbar actions ==
// ======================
$('#nav-buttons a').click(function (e) {
e.preventDefault();
});
$('#to-previous').click(function () {
var previous_dir = getPreviousDir();
if (previous_dir == '') return;
goTo(previous_dir);
});
$('#add-folder').click(function () {
bootbox.prompt(lang['message-name'], function (result) {
if (result == null) return;
createFolder(result);
});
});
$('#upload').click(function () {
$('#uploadModal').modal('show');
});
$('#upload-btn').click(function () {
$(this).html('')
.append($('<i>').addClass('fa fa-refresh fa-spin'))
.append(" " + lang['btn-uploading'])
.addClass('disabled');
function resetUploadForm() {
$('#uploadModal').modal('hide');
$('#upload-btn').html(lang['btn-upload']).removeClass('disabled');
$('input#upload').val('');
}
$('#uploadForm').ajaxSubmit({
success: function (data, statusText, xhr, $form) {
resetUploadForm();
refreshFoldersAndItems(data);
displaySuccessMessage(data);
},
error: function (jqXHR, textStatus, errorThrown) {
displayErrorResponse(jqXHR);
resetUploadForm();
}
});
});
$('#thumbnail-display').click(function () {
show_list = 0;
loadItems();
});
$('#list-display').click(function () {
show_list = 1;
loadItems();
});
$('#list-sort-alphabetic').click(function() {
sort_type = 'alphabetic';
loadItems();
});
$('#list-sort-time').click(function() {
sort_type = 'time';
loadItems();
});
// ======================
// == Folder actions ==
// ======================
$(document).on('click', '.file-item', function (e) {
useFile($(this).data('id'));
});
$(document).on('click', '.folder-item', function (e) {
goTo($(this).data('id'));
});
function goTo(new_dir) {
$('#working_dir').val(new_dir);
loadItems();
}
function getPreviousDir() {
var ds = '/';
var working_dir = $('#working_dir').val();
var last_ds = working_dir.lastIndexOf(ds);
var previous_dir = working_dir.substring(0, last_ds);
return previous_dir;
}
function dir_starts_with(str) {
return $('#working_dir').val().indexOf(str) === 0;
}
function setOpenFolders() {
var folders = $('.folder-item');
for (var i = folders.length - 1; i >= 0; i--) {
// close folders that are not parent
if (! dir_starts_with($(folders[i]).data('id'))) {
$(folders[i]).children('i').removeClass('fa-folder-open').addClass('fa-folder');
} else {
$(folders[i]).children('i').removeClass('fa-folder').addClass('fa-folder-open');
}
}
}
// ====================
// == Ajax actions ==
// ====================
function performLfmRequest(url, parameter, type) {
var data = defaultParameters();
if (parameter != null) {
$.each(parameter, function (key, value) {
data[key] = value;
});
}
return $.ajax({
type: 'GET',
dataType: type || 'text',
url: lfm_route + '/' + url,
data: data,
cache: false
}).fail(function (jqXHR, textStatus, errorThrown) {
displayErrorResponse(jqXHR);
});
}
function displayErrorResponse(jqXHR) {
notify('<div style="max-height:50vh;overflow: scroll;">' + jqXHR.responseText + '</div>');
}
function displaySuccessMessage(data){
if(data == 'OK'){
var success = $('<div>').addClass('alert alert-success')
.append($('<i>').addClass('fa fa-check'))
.append(' File Uploaded Successfully.');
$('#alerts').append(success);
setTimeout(function () {
success.remove();
}, 2000);
}
}
var refreshFoldersAndItems = function (data) {
loadFolders();
if (data != 'OK') {
data = Array.isArray(data) ? data.join('<br/>') : data;
notify(data);
}
};
var hideNavAndShowEditor = function (data) {
$('#nav-buttons > ul').addClass('hidden');
$('#content').html(data);
}
function loadFolders() {
performLfmRequest('folders', {}, 'html')
.done(function (data) {
$('#tree').html(data);
loadItems();
});
}
function loadItems() {
$('#lfm-loader').show();
performLfmRequest('jsonitems', {show_list: show_list, sort_type: sort_type}, 'html')
.done(function (data) {
var response = JSON.parse(data);
$('#content').html(response.html);
$('#nav-buttons > ul').removeClass('hidden');
$('#working_dir').val(response.working_dir);
$('#current_dir').text(response.working_dir);
console.log('Current working_dir : ' + $('#working_dir').val());
if (getPreviousDir() == '') {
$('#to-previous').addClass('hide');
} else {
$('#to-previous').removeClass('hide');
}
setOpenFolders();
})
.always(function(){
$('#lfm-loader').hide();
});
}
function createFolder(folder_name) {
performLfmRequest('newfolder', {name: folder_name})
.done(refreshFoldersAndItems);
}
function rename(item_name) {
bootbox.prompt({
title: lang['message-rename'],
value: item_name,
callback: function (result) {
if (result == null) return;
performLfmRequest('rename', {
file: item_name,
new_name: result
}).done(refreshFoldersAndItems);
}
});
}
function trash(item_name) {
bootbox.confirm(lang['message-delete'], function (result) {
if (result == true) {
performLfmRequest('delete', {items: item_name})
.done(refreshFoldersAndItems);
}
});
}
function cropImage(image_name) {
performLfmRequest('crop', {img: image_name})
.done(hideNavAndShowEditor);
}
function resizeImage(image_name) {
performLfmRequest('resize', {img: image_name})
.done(hideNavAndShowEditor);
}
function download(file_name) {
var data = defaultParameters();
data['file'] = file_name;
location.href = lfm_route + '/download?' + $.param(data);
}
// ==================================
// == Ckeditor, Bootbox, preview ==
// ==================================
function useFile(file_url) {
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 useTinymce3(url) {
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, field_name) {
parent.document.getElementById(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 useCkeditor3(url) {
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) {
var p = url;
var w = data['Properties']['Width'];
var h = data['Properties']['Height'];
window.opener.SetUrl(p,w,h);
}
var url = file_url;
var field_name = getUrlParam('field_name');
var is_ckeditor = getUrlParam('CKEditor');
var is_fcke = typeof data != 'undefined' && data['Properties']['Width'] != '';
var file_path = url.replace(route_prefix, '');
if (window.opener || window.tinyMCEPopup || field_name || getUrlParam('CKEditorCleanUpFuncNum') || is_ckeditor) {
if (window.tinyMCEPopup) { // use TinyMCE > 3.0 integration method
useTinymce3(url);
} else if (field_name) { // tinymce 4 and colorbox
useTinymce4AndColorbox(url, field_name);
} else if(is_ckeditor) { // use CKEditor 3.0 + integration method
useCkeditor3(url);
} else if (is_fcke) { // use FCKEditor 2.0 integration method
useFckeditor2(url);
} else { // standalone button or other situations
window.opener.SetUrl(url, file_path);
}
if (window.opener) {
window.close();
}
} else {
// No editor found, open/download file using browser's default method
window.open(url);
}
}
//end useFile
function defaultParameters() {
return {
working_dir: $('#working_dir').val(),
type: $('#type').val()
};
}
function notImp() {
notify('Not yet implemented!');
}
function notify(message) {
bootbox.alert(message);
}
function fileView(file_url, timestamp) {
bootbox.dialog({
title: lang['title-view'],
message: $('<img>')
.addClass('img img-responsive center-block')
.attr('src', file_url + '?timestamp=' + timestamp),
size: 'large',
onEscape: true,
backdrop: true
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment