统一控制延时
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
* 不要在此文件中自行编写选择器操作逻辑,必须引用 lib 中已封装的方法。
|
||||
*/
|
||||
|
||||
import { fillMatchedField, delay, isSearchPickerField, fillSearchPickerField, isTimePeriodField, isTimeSingleField, fillTimePeriodField, fillTimeSingleField } from "~lib/autofill"
|
||||
import { fillMatchedField, isSearchPickerField, fillSearchPickerField, isTimePeriodField, isTimeSingleField, fillTimePeriodField, fillTimeSingleField } from "~lib/autofill"
|
||||
import { delay } from "~utils/delay"
|
||||
import { extractDomStructure, detectPageLanguage, isJobApplicationForm, buildSelector } from "~lib/dom"
|
||||
import { matchFormFieldsInRange, matchMainFields } from "~lib/formMatcher"
|
||||
import { detectPickerField } from "~lib/pickerDetector"
|
||||
@@ -103,7 +104,7 @@ export async function handleAutoFillCommon(params: AutoFillCommonParams): Promis
|
||||
// const resumeUrl = "https://offerpie.oss-cn-guangzhou.aliyuncs.com/%E5%AE%BE%E5%A4%95%E6%B3%95%E5%B0%BC%E4%BA%9A%E5%A4%A7%E5%AD%A6_%E4%B8%81%E5%B1%B9%E6%B6%B5.pdf"
|
||||
// const uploaded = await detectAndUploadResume(resumeUrl)
|
||||
// console.log(`===== OfferPie: 简历上传 ${uploaded ? "成功" : "跳过(未找到上传按钮或失败)"} =====`)
|
||||
// if (uploaded) await delay(1000) // 等待网站解析简历
|
||||
// if (uploaded) await delay("high") // 等待网站解析简历
|
||||
|
||||
// 4.5 定位经历区块并统计已展开段数
|
||||
const sectionResults = locateExperienceSections(document.body, lang)
|
||||
@@ -331,7 +332,7 @@ export async function handleAutoFillCommon(params: AutoFillCommonParams): Promis
|
||||
const ok = await fillSearchPickerField(f)
|
||||
if (ok) { result.success++ } else { result.failed++ }
|
||||
phaseAFields.push({ labelText: f.labelText, inputElement: f.inputElement, filled: ok, fillValue: f.fillValue, section: f.section, segmentIndex: segIdx })
|
||||
await delay(100)
|
||||
await delay("mid")
|
||||
continue
|
||||
} else {
|
||||
await detectPickerField(f, lang)
|
||||
@@ -346,7 +347,7 @@ export async function handleAutoFillCommon(params: AutoFillCommonParams): Promis
|
||||
if (lastTextInput && !lastTextInputIsPicker) {
|
||||
;(lastTextInput as HTMLElement).click()
|
||||
lastTextInput.focus()
|
||||
await delay(50)
|
||||
await delay("low")
|
||||
lastTextInput.blur()
|
||||
} else {
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
@@ -357,7 +358,7 @@ export async function handleAutoFillCommon(params: AutoFillCommonParams): Promis
|
||||
}
|
||||
document.body.click()
|
||||
}
|
||||
await delay(150)
|
||||
await delay("mid")
|
||||
|
||||
if (!f.isPicker && f.inputElement && !isTimePeriodField(f.key) && !isTimeSingleField(f.key)) {
|
||||
lastTextInput = f.inputElement
|
||||
@@ -404,7 +405,7 @@ export async function handleAutoFillCommon(params: AutoFillCommonParams): Promis
|
||||
if (lastTextInput) {
|
||||
;(lastTextInput as HTMLElement).click()
|
||||
lastTextInput.focus()
|
||||
await delay(50)
|
||||
await delay("low")
|
||||
lastTextInput.blur()
|
||||
} else {
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
@@ -415,7 +416,7 @@ export async function handleAutoFillCommon(params: AutoFillCommonParams): Promis
|
||||
}
|
||||
document.body.click()
|
||||
}
|
||||
await delay(150)
|
||||
await delay("mid")
|
||||
|
||||
if (!f.isPicker && f.inputElement) lastTextInput = f.inputElement
|
||||
}
|
||||
@@ -1257,7 +1258,7 @@ async function b2FillDateTimeField(
|
||||
// 和阶段A同样的方式:点击 input 展开日期面板,然后直接调 fillDatePicker
|
||||
inputEl.focus()
|
||||
;(inputEl as HTMLElement).click()
|
||||
await delay(150)
|
||||
await delay("mid")
|
||||
|
||||
const ok = await fillDatePicker(field)
|
||||
if (ok) {
|
||||
@@ -1339,7 +1340,7 @@ async function handleFillCachedData(params: FillCachedDataParams): Promise<FillC
|
||||
const ok = await b2FillSingleField(inputEl, field.label, field.value, lang)
|
||||
if (ok) { result.success++; usedInputs.add(inputEl); setFieldHighlight(inputEl, "greenTwo") } else { result.failed++ }
|
||||
}
|
||||
await delay(100)
|
||||
await delay("mid")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1389,7 +1390,7 @@ async function handleFillCachedData(params: FillCachedDataParams): Promise<FillC
|
||||
}).length
|
||||
const clicked = await clickAddButton(addBtn, titleEl, nextTitleEl, beforeCount)
|
||||
if (!clicked) { console.log(` [B2] "${sectionData.title}" 点击添加按钮无效`); break }
|
||||
await delay(150)
|
||||
await delay("mid")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1407,7 +1408,7 @@ async function handleFillCachedData(params: FillCachedDataParams): Promise<FillC
|
||||
const ok = await b2FillSingleField(inputEl, field.label, field.value, lang)
|
||||
if (ok) { result.success++; usedInputs.add(inputEl); setFieldHighlight(inputEl, "greenTwo") } else { result.failed++ }
|
||||
}
|
||||
await delay(100)
|
||||
await delay("mid")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1426,7 +1427,7 @@ async function handleFillCachedData(params: FillCachedDataParams): Promise<FillC
|
||||
const ok = await b2FillSingleField(inputEl, field.label, field.value, lang)
|
||||
if (ok) { result.success++; usedInputs.add(inputEl); setFieldHighlight(inputEl, "greenTwo") } else { result.failed++ }
|
||||
}
|
||||
await delay(100)
|
||||
await delay("mid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user