Skip to content

Commit

Permalink
fix: 修正在「我的投資」不會正確顯示下單輔助巨集的問題
Browse files Browse the repository at this point in the history
  • Loading branch information
aqzhyi committed May 15, 2020
1 parent e2196b0 commit 382c873
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/components/ExecutionDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const com = {
?.trim() ||
$('[data-etoro-automation-id="execution-deposit-button"]')
.html()
.trim())
?.trim())
)
},
get isConstructed() {
Expand Down
59 changes: 30 additions & 29 deletions src/etoro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,40 @@ const readyIntervalId = globalThis.setInterval(async () => {
emitter.on(Events.ready, () => {
ExecutionDialog.log(`安排好按鈕`)

$('body').delegate(
`
.trade-button-title
, [automation-id="buy-sell-button-rate-value"]
, [automation-id="trade-button"]
, .etoro-trade-button
`,
'click',
() => {
if (!storage.findConfig().executionMacroEnabled) {
ExecutionDialog.log(`功能未開啟`)
return
}
let watchId

ExecutionDialog.log(`開始偵測`)
const construct = () => {
ExecutionDialog.log('偵測中...', ExecutionDialog)

const watchId = globalThis.setInterval(() => {
ExecutionDialog.log('偵測中...', ExecutionDialog)
if (ExecutionDialog.isParentConstructed && !ExecutionDialog.isConstructed) {
ExecutionDialog.construct()
}

if (
ExecutionDialog.isParentConstructed &&
!ExecutionDialog.isConstructed
) {
ExecutionDialog.construct()
}
if (ExecutionDialog.isConstructed) {
globalThis.clearInterval(watchId)
ExecutionDialog.log(`結束偵測`)
}
}

if (ExecutionDialog.isConstructed) {
globalThis.clearInterval(watchId)
ExecutionDialog.log(`結束偵測`)
}
}, 250)
},
)
$('body').delegate(`.uidialog-content`, 'mouseover', () => {
if (!storage.findConfig().executionMacroEnabled) {
ExecutionDialog.log(`功能未開啟`)
return
}

ExecutionDialog.log(`開始偵測`)

globalThis.clearInterval(watchId)
construct()
watchId = globalThis.setInterval(construct, 250)
})

$('body').delegate(`.uidialog-content`, 'mouseout', () => {
globalThis.setTimeout(() => {
ExecutionDialog.log(`結束偵測`)
globalThis.clearInterval(watchId)
}, 300)
})
})

/**
Expand Down
4 changes: 2 additions & 2 deletions src_dist/etoro.bundle.js

Large diffs are not rendered by default.

0 comments on commit 382c873

Please sign in to comment.