🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:admin.js
/* VELORA Admin JS */ (function($) { 'use strict'; $(document).ready(function() { // Sidebar Toggle $('#sidebarToggle').on('click', function() { $('#sidebar').toggleClass('show'); }); // Close sidebar on outside click (mobile) $(document).on('click', function(e) { if ($(window).width() <= 992) { if (!$(e.target).closest('#sidebar, #sidebarToggle').length) { $('#sidebar').removeClass('show'); } } }); // Confirm Delete $(document).on('click', '.confirm-delete', function(e) { if (!confirm('Are you sure you want to delete this? This action cannot be undone.')) { e.preventDefault(); } }); // Image Preview $(document).on('change', 'input[type="file"][data-preview]', function() { const previewId = $(this).data('preview'); const file = this.files[0]; if (file) { const reader = new FileReader(); reader.onload = function(e) { $('#' + previewId).attr('src', e.target.result); }; reader.readAsDataURL(file); } }); // Toggle Status $(document).on('click', '.toggle-status', function() { const id = $(this).data('id'); const table = $(this).data('table'); const $btn = $(this); $.ajax({ url: ADMIN_PATH + 'ajax/toggle-status.php', type: 'POST', data: { id: id, table: table, csrf_token: CSRF_TOKEN }, dataType: 'json', success: function(response) { if (response.success) { toastr.success('Status updated'); $btn.toggleClass('btn-success-admin btn-secondary-admin'); $btn.find('i').toggleClass('fa-check fa-times'); } else { toastr.error('Failed to update'); } } }); }); // Tooltips var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); tooltipTriggerList.map(function (el) { return new bootstrap.Tooltip(el); }); // Search Filter let searchTimer; $('.table-search').on('input', function() { const query = $(this).val().toLowerCase(); const targetTable = $(this).data('target'); clearTimeout(searchTimer); searchTimer = setTimeout(function() { $(targetTable + ' tbody tr').each(function() { const text = $(this).text().toLowerCase(); $(this).toggle(text.indexOf(query) > -1); }); }, 200); }); // Sort Table $(document).on('click', '.sortable', function() { const table = $(this).parents('table').eq(0); const rows = table.find('tbody tr').toArray().sort(comparer($(this).index())); this.asc = !this.asc; if (!this.asc) rows.reverse(); for (let i = 0; i < rows.length; i++) { table.append(rows[i]); } }); function comparer(index) { return function(a, b) { const valA = getCellValue(a, index); const valB = getCellValue(b, index); return $.isNumeric(valA) && $.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB); }; } function getCellValue(row, index) { return $(row).children('td').eq(index).text(); } }); })(jQuery);
Save Changes
Cancel
Create New File
Create New Folder