Files
Benjamin f34019c802 Continue Upload Script.
Pause during rewrite of RHPZ Server code.
2026-01-29 18:49:47 +01:00

29 lines
1.0 KiB
TypeScript

import {type Can_Upload_Detail, I} from "./globals";
import {Upload} from "./class-upload";
import {DropContainer} from "./class-drop-container";
document.addEventListener('DOMContentLoaded', () => {
if( !document.getElementById( 'file-container' ) ) // Check if exists.
return;
// Add PostID if edit.
let url_params = new URLSearchParams(window.location.search);
// @ts-ignore
I.is_edit = url_params.has( 'edit_entry' );
I.custom_post_type = jQuery( 'input[name="custom_post_type"]').val() || 'unknown';
I.reserved_post_id = url_params.get('edit_entry' ) || null;
// @ts-ignore
I.drop_container = new DropContainer( document.getElementById( 'file-container' ) as HTMLElement, document.getElementById( 'file-container-text' ) as HTMLElement );
// @ts-ignore
document.addEventListener( 'can_upload', (e: CustomEvent<Can_Upload_Detail> ) => {
const { file } = e.detail;
if( !I.during_upload ) // @ts-ignore
I.upload = new Upload( file );
});
})