|
@@ -672,7 +672,13 @@ export function findTweetByIdDoTask({ tweet_Id = '', follow_names = [] }, task_t
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+function clickByDataTestId(e, id, callback) {
|
|
|
|
+ if (e.target.dataset && e.target.dataset.testid && e.target.dataset.testid == id) {
|
|
|
|
+ callback()
|
|
|
|
+ } else if (e.target.closest('div[data-testid=' + id + ']')) {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
// 校验关注推特状态
|
|
// 校验关注推特状态
|
|
export function checkTwitterTaskState() {
|
|
export function checkTwitterTaskState() {
|
|
@@ -695,49 +701,20 @@ export function checkTwitterTaskState() {
|
|
}
|
|
}
|
|
tweet_Id = getQueryString('tweet_id')
|
|
tweet_Id = getQueryString('tweet_id')
|
|
|
|
|
|
- // 获取关注名字 获取推特Id
|
|
|
|
- let confirm_btn = document.querySelector('div[data-testid=confirmationSheetConfirm]')
|
|
|
|
- let confirm_btn_status
|
|
|
|
- let cancel_btn = document.querySelector('div[data-testid=confirmationSheetCancel]')
|
|
|
|
- let cancel_btn_status
|
|
|
|
-
|
|
|
|
- // let page_follow_btn = document.querySelector('div[aria-describedby]')
|
|
|
|
- // let page_follow_btn_status
|
|
|
|
-
|
|
|
|
- let observer = new MutationObserver(() => {
|
|
|
|
- if (confirm_btn && !confirm_btn_status) {
|
|
|
|
- confirm_btn_status = true
|
|
|
|
- confirm_btn.onclick = (e) => {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data ,task_done:true}, () => { })
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- confirm_btn = document.querySelector('div[data-testid=confirmationSheetConfirm]')
|
|
|
|
- }
|
|
|
|
- if(cancel_btn && !cancel_btn_status){
|
|
|
|
- cancel_btn_status= true
|
|
|
|
- cancel_btn.onclick = (e) => {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data ,task_done:false}, () => { })
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- cancel_btn = document.querySelector('div[data-testid=confirmationSheetCancel]')
|
|
|
|
- }
|
|
|
|
- // if (page_follow_btn && page_follow_btn.dataset && page_follow_btn.dataset.testid && !page_follow_btn_status) {
|
|
|
|
- // page_follow_btn_status = true
|
|
|
|
- // if (page_follow_btn.dataset.testid.includes('unfollow')) {
|
|
|
|
- // // 发送
|
|
|
|
- // chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id }, () => { })
|
|
|
|
- // }
|
|
|
|
- // } else {
|
|
|
|
- // page_follow_btn = document.querySelector('div[aria-describedby]')
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- if (confirm_btn_status && cancel_btn_status) {
|
|
|
|
- observer.disconnect()
|
|
|
|
|
|
+ // let root_status
|
|
|
|
+ document.body.addEventListener('click', (e) => {
|
|
|
|
+ // 点击 确认
|
|
|
|
+ clickByDataTestId(e, 'confirmationSheetConfirm', () => {
|
|
|
|
+ chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data, task_done: true }, () => { })
|
|
|
|
+ })
|
|
|
|
+ // 点击取消
|
|
|
|
+ clickByDataTestId(e, 'confirmationSheetCancel', () => {
|
|
|
|
+ chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data, task_done: false }, () => { })
|
|
|
|
+ })
|
|
|
|
+ // 点击 蒙层
|
|
|
|
+ if (e.target && e.target.nextSibling && e.target.nextSibling.dataset && e.target.nextSibling.dataset.testid == 'confirmationSheetDialog') {
|
|
|
|
+ chrome.runtime.sendMessage({ actionType: "DO_TASK", tweet_Id, task_type, task_data, task_done: false }, () => { })
|
|
}
|
|
}
|
|
- });
|
|
|
|
- observer.observe(document.body, { attributes: false, childList: true, subtree: true });
|
|
|
|
|
|
+ }, true)
|
|
|
|
|
|
- // 打开iframe
|
|
|
|
- // 点击操作
|
|
|
|
- // 删除iframe
|
|
|
|
}
|
|
}
|