Skip to content

Commit

Permalink
Support uploaded story files again
Browse files Browse the repository at this point in the history
  • Loading branch information
curiousdannii committed Oct 4, 2024
1 parent d666aa2 commit c953cf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
31 changes: 15 additions & 16 deletions src/common/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ class ParchmentLauncher
const storyfile = this.get_storyfile_path()
if (!storyfile) {
// Set up all the ways we can load a story
// $('#custom-file-upload').show().on('keydown', event => {
// if (event.keyCode === 32 /*Space*/ || event.keyCode === 13 /*Enter*/) {
// event.target.click()
// }
// })
// $('#file-upload').on('change', () => {
// const file = ($('#file-upload')[0] as HTMLInputElement)?.files?.[0]
// if (file) {
// this.load_uploaded_file(file)
// }
// })
$('#custom-file-upload').show().on('keydown', event => {
if (event.keyCode === 32 /*Space*/ || event.keyCode === 13 /*Enter*/) {
event.target.click()
}
})
$('#file-upload').on('change', () => {
const file = ($('#file-upload')[0] as HTMLInputElement)?.files?.[0]
if (file) {
this.load_uploaded_file(file)
}
})
$('#play-url').show()
$('#play-url-button').on('click', () => this.load_url())
$('#play-url-input').on('keydown', event => {
Expand Down Expand Up @@ -118,7 +118,7 @@ class ParchmentLauncher
}

// Identify the format
let format = find_format(story.format, story.url)
let format = find_format(story.format, story.path || story.url)

// Look for the progress bar
let progress = 0
Expand Down Expand Up @@ -174,18 +174,17 @@ class ParchmentLauncher
}
}

/*async load_uploaded_file(file: File) {
async load_uploaded_file(file: File) {
try {
this.load({
data: await read_uploaded_file(file),
url: file.name,
path: await this.options.Dialog.upload(file),
})
}
catch (err) {
this.options.GlkOte.error(err)
throw err
}
}*/
}

load_url() {
const url = $('#play-url-input').val() as string
Expand Down
2 changes: 1 addition & 1 deletion src/upstream/asyncglk

0 comments on commit c953cf0

Please sign in to comment.