mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 13:48:51 +08:00
Fix bug on iOS safari
This commit is contained in:
@@ -29,7 +29,7 @@ type Props<T extends keyof TextType> = {
|
||||
fullwidth?: boolean;
|
||||
disabled?: boolean;
|
||||
children?: ComponentChildren;
|
||||
set_value?: (v: TextType[T]) => void;
|
||||
set_value?: (v?: TextType[T]) => void;
|
||||
min?: DataType[T];
|
||||
max?: DataType[T];
|
||||
outlined?: boolean;
|
||||
@@ -78,7 +78,7 @@ export default class BTextField<T extends keyof TextType>
|
||||
}
|
||||
}
|
||||
}
|
||||
set_value(value: TextType[T]) {
|
||||
set_value(value?: TextType[T]) {
|
||||
if (this.props.set_value) {
|
||||
this.props.set_value(value);
|
||||
} else if (this.context) {
|
||||
@@ -108,16 +108,15 @@ export default class BTextField<T extends keyof TextType>
|
||||
const t = b as HTMLElement;
|
||||
const d = t.querySelector("input");
|
||||
if (d) {
|
||||
const n = this.get_value(d);
|
||||
if (typeof n === "number" && isNaN(n)) return undefined;
|
||||
return n;
|
||||
return this.get_value(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
get_value(e: HTMLInputElement): TextType[T] {
|
||||
get_value(e: HTMLInputElement): TextType[T] | undefined {
|
||||
const type = this.props.type;
|
||||
if (!e.value.length) return undefined;
|
||||
// @ts-ignore Checked
|
||||
if (type === "text" || type === "password") return e.value;
|
||||
// @ts-ignore Checked
|
||||
|
||||
@@ -74,24 +74,26 @@ export default class NewTask extends Component<NewTaskProps, State> {
|
||||
}
|
||||
}, [task_type]);
|
||||
if (task_type === TaskType.Download) {
|
||||
const set_url: StateUpdater<string> = (u) => {
|
||||
const n = typeof u === "string" ? u : u(url || "");
|
||||
const set_url: StateUpdater<string | undefined> = (u) => {
|
||||
const n = typeof u === "string" ? u : u ? u(url) : u;
|
||||
set_url1(n);
|
||||
const p = parseUrl(n);
|
||||
if (p && p.type !== UrlType.Single) {
|
||||
set_dgid(p.gid);
|
||||
set_token1(p.token);
|
||||
if (n) {
|
||||
const p = parseUrl(n);
|
||||
if (p && p.type !== UrlType.Single) {
|
||||
set_dgid(p.gid);
|
||||
set_token1(p.token);
|
||||
}
|
||||
}
|
||||
};
|
||||
const set_dgid: StateUpdater<number> = (u) => {
|
||||
const g = typeof u === "number" ? u : u(dgid || 0);
|
||||
const set_dgid: StateUpdater<number | undefined> = (u) => {
|
||||
const g = typeof u === "number" ? u : u ? u(dgid) : u;
|
||||
set_dgid1(g);
|
||||
if (g && token) {
|
||||
set_url1(`https://e-hentai.org/g/${g}/${token}/`);
|
||||
}
|
||||
};
|
||||
const set_token: StateUpdater<string> = (u) => {
|
||||
const n = typeof u === "string" ? u : u(url || "");
|
||||
const set_token: StateUpdater<string | undefined> = (u) => {
|
||||
const n = typeof u === "string" ? u : u ? u(url) : u;
|
||||
set_token1(n);
|
||||
if (dgid && n) {
|
||||
set_url1(`https://e-hentai.org/g/${dgid}/${n}/`);
|
||||
@@ -228,10 +230,10 @@ export default class NewTask extends Component<NewTaskProps, State> {
|
||||
set_abort(undefined);
|
||||
});
|
||||
};
|
||||
const set_ezgid = (g: number) => {
|
||||
const set_ezgid = (g: number | undefined) => {
|
||||
if (abort) abort.abort();
|
||||
set_ezgid1(g);
|
||||
if (!isNaN(g)) fetch_ginfo(g);
|
||||
if (g !== undefined && !isNaN(g)) fetch_ginfo(g);
|
||||
};
|
||||
let ginfo_div = null;
|
||||
if (ginfo?.ok) {
|
||||
|
||||
Reference in New Issue
Block a user