{{-- Gallery Loader script module --}} const loadGallery = () => { const $container = $('#gallery-items-container-' + pickerId); $container.html('
'); const params = { owner_module: ownerModule, allow_shared: allowShared, allowed_mime_types: filterMimeTypes, search: $('#gallery-search-' + pickerId).val(), type: $('#gallery-filter-type-' + pickerId).val(), archived: viewArchived }; $.get(urls.index, params, (anexos) => { let html = '
'; anexos.forEach((anexo) => { const diskUrl = '/storage/' + anexo.file_path; const isImg = anexo.mime_type.startsWith('image/'); const isPdf = anexo.mime_type === 'application/pdf'; const isAudio = anexo.mime_type.startsWith('audio/') || ['application/ogg', 'application/x-cdf'].includes(anexo.mime_type); const isExcel = anexo.file_path.endsWith('.xlsx') || anexo.file_path.endsWith('.xls') || anexo.file_path.endsWith('.csv') || anexo.file_path.endsWith('.ods') || anexo.mime_type.includes('spreadsheet') || anexo.mime_type.includes('excel') || anexo.mime_type === 'text/csv'; let displayThumb = ''; if (isImg) { displayThumb = ``; } else if (isPdf) { displayThumb = ``; } else if (isAudio) { displayThumb = ``; } else if (isExcel) { displayThumb = ``; } else { displayThumb = ``; } html += `
`; }); html += '
'; $container.html(anexos.length ? html : '

Nenhuma mídia encontrada nesta busca.

'); }); }; const selectMedia = (id, path, alt = '', mimeType = '', description = '') => { if (activeCallback) { activeCallback(id, path, alt, mimeType, description); } var myPickerModal = bootstrap.Modal.getInstance(document.getElementById('gallery-picker-modal-' + pickerId)); if (myPickerModal) myPickerModal.hide(); };