mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
refactor code about collect job info
This commit is contained in:
@@ -49,9 +49,8 @@ const attachRequestsListener = async (target: Target) => {
|
||||
return
|
||||
}
|
||||
|
||||
function handleJobDetailPage({ encryptJobId } = { encryptJobId: null }) {
|
||||
Promise.resolve()
|
||||
.then(async () => {
|
||||
// FIXME: might not work
|
||||
async function handleJobDetailPage({ encryptJobId } = { encryptJobId: null }) {
|
||||
if (!encryptJobId) {
|
||||
return
|
||||
}
|
||||
@@ -60,7 +59,8 @@ const attachRequestsListener = async (target: Target) => {
|
||||
({ encryptJobId }) => {
|
||||
return (
|
||||
location.href.startsWith(`https://www.zhipin.com/job_detail/${encryptJobId}`) &&
|
||||
document.readyState === 'complete'
|
||||
(!!document.querySelector('#main .job-banner') ||
|
||||
!!document.documentElement.innerText?.includes(`您访问的页面不存在`))
|
||||
)
|
||||
},
|
||||
undefined,
|
||||
@@ -105,8 +105,6 @@ const attachRequestsListener = async (target: Target) => {
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
})
|
||||
.catch(() => void 0)
|
||||
}
|
||||
|
||||
if (page.url().match(/^https:\/\/www.zhipin.com\/job_detail\/(.+)\.html/)) {
|
||||
@@ -200,7 +198,7 @@ const attachRequestsListener = async (target: Target) => {
|
||||
)
|
||||
const requestBody = new URLSearchParams(response.request().postData())
|
||||
|
||||
const securityIdInRequest = requestBody.get("securityId")
|
||||
const securityIdInRequest = requestBody.get('securityId')
|
||||
const currentJobSecurityId = currentJobData?.securityId
|
||||
|
||||
if (securityIdInRequest !== currentJobSecurityId) {
|
||||
|
||||
Reference in New Issue
Block a user