Continue Upload Script.
Pause during rewrite of RHPZ Server code.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import {__, FORBIDDEN_CARS, I } from "./globals";
|
||||
import {__, FORBIDDEN_CARS, I, API } from "./globals";
|
||||
import {DropContainer} from "./class-drop-container";
|
||||
import {Reserve_Post_ID} from "./class-reserve-post-id";
|
||||
import {Set_Favorite_Server} from "./class-set-favorite-server";
|
||||
declare const _romhackplaza_script_uploader: any;
|
||||
declare const romhackplaza_modal_submissions: any;
|
||||
|
||||
@@ -27,6 +29,7 @@ export class Upload {
|
||||
}
|
||||
|
||||
this.switchDuringUpload();
|
||||
// @ts-ignore
|
||||
if( typeof I.drop_container !== 'undefined' && I.drop_container instanceof DropContainer )
|
||||
I.drop_container.switch();
|
||||
|
||||
@@ -36,8 +39,56 @@ export class Upload {
|
||||
this.progress_bar = progress.querySelector('.bar') as HTMLElement;
|
||||
}
|
||||
|
||||
if( I.reserved_post_id === undefined || I.reserved_post_id === null )
|
||||
console.log( "ok" );
|
||||
if( I.reserved_post_id === undefined || I.reserved_post_id === null ){
|
||||
// Reserve a post ID.
|
||||
new Reserve_Post_ID( this.step1_checkFileExists );
|
||||
} else
|
||||
// Already reserved.
|
||||
this.step1_checkFileExists();
|
||||
|
||||
}
|
||||
|
||||
step1_checkFileExists = () => {
|
||||
|
||||
if( I.favorite_server_set === false ){
|
||||
// @ts-ignore
|
||||
new Set_Favorite_Server( chosenDownloadServerId || 0 );
|
||||
I.favorite_server_set = true;
|
||||
}
|
||||
|
||||
API.check_file_existence( this.file.name ).then( exists => {
|
||||
|
||||
if( !exists ){
|
||||
this.step3_uploadFile();
|
||||
// @ts-ignore
|
||||
document.getElementById( 'cancelButton' )?.style.display = 'block';
|
||||
} else {
|
||||
|
||||
let want_to_delete = window.confirm( __( "File already exists! Proceed with upload and overwrite it ?" ) );
|
||||
if( want_to_delete )
|
||||
this.step2_deleteFileBeforeUpload();
|
||||
|
||||
else{
|
||||
|
||||
// @ts-ignore
|
||||
if( typeof I.drop_container !== 'undefined' && I.drop_container instanceof DropContainer )
|
||||
I.drop_container.switch();
|
||||
this.switchDuringUpload();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
step2_deleteFileBeforeUpload = () => {
|
||||
|
||||
|
||||
}
|
||||
|
||||
step3_uploadFile = () => {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user