|
@@ -72,6 +72,7 @@ export function hideIframeHandler() {
|
|
/**
|
|
/**
|
|
* 展示twitter原生发布框
|
|
* 展示twitter原生发布框
|
|
*/
|
|
*/
|
|
|
|
+
|
|
export function showTwitterPublishDialogHandler(publishRes) {
|
|
export function showTwitterPublishDialogHandler(publishRes) {
|
|
let bigBtn = document.querySelector('a[data-testid="SideNav_NewTweet_Button"]');
|
|
let bigBtn = document.querySelector('a[data-testid="SideNav_NewTweet_Button"]');
|
|
if(bigBtn) {
|
|
if(bigBtn) {
|
|
@@ -81,6 +82,11 @@ export function showTwitterPublishDialogHandler(publishRes) {
|
|
smallBtn && smallBtn.click();
|
|
smallBtn && smallBtn.click();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ setChromeStorage({ publishData: JSON.stringify(publishRes) })
|
|
|
|
+
|
|
|
|
+ addPublishTipsIframe({
|
|
|
|
+ srcContent: publishRes.srcContent
|
|
|
|
+ })
|
|
_setPublishContent(publishRes.srcContent);
|
|
_setPublishContent(publishRes.srcContent);
|
|
_publishTweetEvent(publishRes.postId, bindTwitterArtMethod);
|
|
_publishTweetEvent(publishRes.postId, bindTwitterArtMethod);
|
|
}
|
|
}
|
|
@@ -282,6 +288,25 @@ function _addIframe() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function addPublishTipsIframe({srcContent}) {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ let dialog = document.querySelector('div[role="dialog"]').querySelector('div[role="dialog"]')
|
|
|
|
+
|
|
|
|
+ if(dialog) {
|
|
|
|
+ let right = dialog.offsetLeft - 15 - 266, top = window.innerHeight * 0.05 + dialog.offsetHeight - 60 - 160;
|
|
|
|
+
|
|
|
|
+ let iframe = document.createElement('iframe');
|
|
|
|
+ iframe.id = 'de-publish-tips'
|
|
|
|
+ iframe.src = chrome.runtime.getURL('/iframe/publish-tips.html');
|
|
|
|
+ iframe.style.cssText = `border: medium none; width:266px;min-height:178px;position: fixed; right: ${right}px; top: ${top}px;`
|
|
|
|
+ let iframeContent = document.getElementById('de-publish-tips');
|
|
|
|
+ if(!iframeContent) {
|
|
|
|
+ dialog.appendChild(iframe)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, 1000)
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 点击deNet按钮处理
|
|
* 点击deNet按钮处理
|
|
* @private
|
|
* @private
|
|
@@ -623,7 +648,8 @@ export function init() {
|
|
}
|
|
}
|
|
}, 1000);
|
|
}, 1000);
|
|
renderDom();
|
|
renderDom();
|
|
- checkTwitterTaskState()
|
|
|
|
|
|
+ checkTwitterTaskState();
|
|
|
|
+
|
|
getChromeStorage("popupShowPublishDialog", (res) => {
|
|
getChromeStorage("popupShowPublishDialog", (res) => {
|
|
console.log("popupShowPublishDialog", res);
|
|
console.log("popupShowPublishDialog", res);
|
|
if (res && res.show) {
|
|
if (res && res.show) {
|