|
@@ -800,6 +800,8 @@ export function init() {
|
|
renderDom();
|
|
renderDom();
|
|
checkTwitterTaskState();
|
|
checkTwitterTaskState();
|
|
|
|
|
|
|
|
+ appendPopupPage();
|
|
|
|
+
|
|
onBodyClick();
|
|
onBodyClick();
|
|
initBuyNFT()
|
|
initBuyNFT()
|
|
|
|
|
|
@@ -1288,31 +1290,64 @@ export const showNFTSale = () => {
|
|
document.querySelector('div[id="de-nft-node"]').style.display = 'block';
|
|
document.querySelector('div[id="de-nft-node"]').style.display = 'block';
|
|
}
|
|
}
|
|
|
|
|
|
-export const appendPopupPage = (params) => {
|
|
|
|
|
|
+export const appendPopupPage = (params = {}) => {
|
|
let { path = '' } = params;
|
|
let { path = '' } = params;
|
|
|
|
|
|
let iframe = document.createElement('iframe');
|
|
let iframe = document.createElement('iframe');
|
|
iframe.id = 'de-popup-page';
|
|
iframe.id = 'de-popup-page';
|
|
iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
iframe.style.cssText = `border: medium none; width: 375px;
|
|
iframe.style.cssText = `border: medium none; width: 375px;
|
|
- height: 600px;position: fixed; right: 16px; top: 16px;background: #FFFFFF;border: 0.5px solid #919191;box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);box-sizing: border-box;z-index: 1000;`
|
|
|
|
- let iframeContent = document.getElementById('de-extension-popup');
|
|
|
|
|
|
+ height: 600px;position: fixed; right: 16px; top: 16px;background: #FFFFFF;border: 0.5px solid #919191;box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.2);box-sizing: border-box;z-index: 1000;
|
|
|
|
+ animation-duration: 0.5s !important;
|
|
|
|
+ animation-timing-function: ease-in-out !important;
|
|
|
|
+ animation-fill-mode: forwards !important;
|
|
|
|
+ transition: all 1s ease 0s !important;right: -385px;`
|
|
|
|
+ let iframeContent = document.getElementById('de-popup-page');
|
|
if (!iframeContent) {
|
|
if (!iframeContent) {
|
|
document.querySelector('body').appendChild(iframe);
|
|
document.querySelector('body').appendChild(iframe);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-export const showPopupPage = (params) => {
|
|
|
|
|
|
+export const showPopupPage = (params = {}) => {
|
|
let { path = '' } = params;
|
|
let { path = '' } = params;
|
|
hidePinTips();
|
|
hidePinTips();
|
|
hideNoticeBindTweet();
|
|
hideNoticeBindTweet();
|
|
- appendPopupPage({ path });
|
|
|
|
|
|
+
|
|
|
|
+ let iframe = document.getElementById('de-popup-page');
|
|
|
|
+ if (iframe) {
|
|
|
|
+ iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
|
|
+ iframe.style.transform = 'translateX(-' + 395 + 'px)';
|
|
|
|
+
|
|
|
|
+ chrome.runtime.sendMessage({
|
|
|
|
+ actionType: "CONTENT_POPUP_PAGE_SHOW",
|
|
|
|
+ data: { }
|
|
|
|
+ }, () => { })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
export const hidePopupPage = () => {
|
|
export const hidePopupPage = () => {
|
|
let iframe = document.getElementById('de-popup-page');
|
|
let iframe = document.getElementById('de-popup-page');
|
|
if (iframe) {
|
|
if (iframe) {
|
|
- document.querySelector('body').removeChild(iframe);
|
|
|
|
|
|
+ iframe.style.transform = 'translateX(' + 385 + 'px)';
|
|
|
|
+ chrome.runtime.sendMessage({
|
|
|
|
+ actionType: "CONTENT_POPUP_PAGE_HIDE",
|
|
|
|
+ data: { }
|
|
|
|
+ }, () => { })
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+export const tiggerInjectPopupPage = () => {
|
|
|
|
+ console.log('tiggerInjectPopupPage',)
|
|
|
|
+ let iframeContent = document.getElementById('de-popup-page');
|
|
|
|
+ if (iframeContent) {
|
|
|
|
+ hidePinTips();
|
|
|
|
+ hideNoticeBindTweet();
|
|
|
|
+ let {transform = ''} = iframeContent.style;
|
|
|
|
+ if(transform == 'translateX(385px)' || !transform) {
|
|
|
|
+ showPopupPage();
|
|
|
|
+ } else {
|
|
|
|
+ hidePopupPage();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|