|
@@ -85,7 +85,7 @@ export function showTwitterPublishDialogHandler(publishRes) {
|
|
|
setChromeStorage({ publishData: JSON.stringify(publishRes) })
|
|
|
|
|
|
addPublishTipsIframe({
|
|
|
- srcContent: publishRes.srcContent
|
|
|
+ srcContent: publishRes.copyContent
|
|
|
})
|
|
|
_setPublishContent(publishRes.srcContent);
|
|
|
_publishTweetEvent(publishRes, bindTwitterArtMethod);
|
|
@@ -163,6 +163,7 @@ function _publishTweetEvent(params, cb) {
|
|
|
let dialog = document.querySelector('div[role="dialog"]');
|
|
|
if (dialog) {
|
|
|
publishTweetBtn = dialog.querySelector('div[data-testid="tweetButton"]');
|
|
|
+ onClosePublishDialogHandle(dialog, params)
|
|
|
} else {
|
|
|
let domMain = document.querySelector('main[role="main"]');
|
|
|
publishTweetBtn = domMain && domMain.querySelector('div[data-testid="tweetButton"]');
|
|
@@ -171,15 +172,33 @@ function _publishTweetEvent(params, cb) {
|
|
|
publishTweetBtn && publishTweetBtn.addEventListener('click', function () {
|
|
|
bindTwitterArt.needBind = true;
|
|
|
bindTwitterArt.postId = params.postId;
|
|
|
- checkIsShowReSend(dialog, params);
|
|
|
+ // checkIsShowReSend(dialog, params);
|
|
|
cb && cb()
|
|
|
});
|
|
|
}, 800)
|
|
|
}
|
|
|
|
|
|
+function onClosePublishDialogHandle(dom, params) {
|
|
|
+ dom.querySelector('div[role="group"]').addEventListener('click', function () {
|
|
|
+ setTimeout(() => {
|
|
|
+ let parent = document.querySelector('div[data-testid="confirmationSheetDialog"]');
|
|
|
+ if(parent) {
|
|
|
+ let btnArr = parent.querySelectorAll('div[role=button]')
|
|
|
+ for(let i = 0; i < btnArr.length; i++) {
|
|
|
+ let btn = btnArr[i];
|
|
|
+ btn.addEventListener('click', function() {
|
|
|
+ let taskLuckdropId = JSON.parse(params.postBizData).taskLuckdropId;
|
|
|
+ noticeBindTweet({ postId: params.postId, taskLuckdropId});
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
function checkIsShowReSend(dom, params) {
|
|
|
let str = dom.querySelector('div[data-contents="true"]').innerHTML;
|
|
|
- if (str.indexOf('#DeNet') < 0 || str.indexOf(params.postId) < 0) {
|
|
|
+ if (str.indexOf(params.postId) < 0) {
|
|
|
let taskLuckdropId = JSON.parse(params.postBizData).taskLuckdropId;
|
|
|
noticeBindTweet({ postId: params.postId, taskLuckdropId});
|
|
|
}
|
|
@@ -710,7 +729,8 @@ export function init() {
|
|
|
setTimeout(() => {
|
|
|
showTwitterPublishDialogHandler({
|
|
|
srcContent: res.srcContent,
|
|
|
- postId: res.postId
|
|
|
+ postId: res.postId,
|
|
|
+ copyContent: res.copyContent || ''
|
|
|
});
|
|
|
}, 1500);
|
|
|
chrome.storage.local.remove("popupShowPublishDialog");
|
|
@@ -931,6 +951,9 @@ export function checkTwitterTaskState() {
|
|
|
|
|
|
export function getTweetAuthorByDom(params) {
|
|
|
let iframe = document.getElementById(params.postId);
|
|
|
+ if(!iframe) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
let fullNameDom;
|
|
|
let pathNameArr = window.location.pathname.split('/');
|
|
|
if (pathNameArr.length >= 2 && pathNameArr[pathNameArr.length - 2] == 'status') {
|