Merge pull request #1091 from city-unit/feature/chub

This commit is contained in:
Cohee 2023-09-04 20:15:41 +03:00 committed by GitHub
commit 8636987d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 15 deletions

View File

@ -6753,6 +6753,22 @@ function connectAPISlash(_, text) {
toastr.info(`API set to ${text}, trying to connect..`); toastr.info(`API set to ${text}, trying to connect..`);
} }
export function processDroppedFiles(files) {
const allowedMimeTypes = [
'application/json',
'image/png',
'image/webp',
];
for (const file of files) {
if (allowedMimeTypes.includes(file.type)) {
importCharacter(file);
} else {
toastr.warning('Unsupported file type: ' + file.name);
}
}
}
function importCharacter(file) { function importCharacter(file) {
const ext = file.name.match(/\.(\w+)$/); const ext = file.name.match(/\.(\w+)$/);
if ( if (
@ -8798,21 +8814,6 @@ jQuery(async function () {
processDroppedFiles(files); processDroppedFiles(files);
}); });
function processDroppedFiles(files) {
const allowedMimeTypes = [
'application/json',
'image/png',
'image/webp',
];
for (const file of files) {
if (allowedMimeTypes.includes(file.type)) {
importCharacter(file);
} else {
toastr.warning('Unsupported file type: ' + file.name);
}
}
}
$("#charListGridToggle").on('click', async () => { $("#charListGridToggle").on('click', async () => {
doCharListDisplaySwitch(); doCharListDisplaySwitch();