|
@@ -257,7 +257,10 @@ function _addDeNetEditBtn(parent, dom, isClick = false) {
|
|
|
businessType: Report.businessType.buttonView,
|
|
|
objectType: Report.objectType.buttonSecond
|
|
|
});
|
|
|
- parent.parentNode.insertBefore(dom, parent.nextElementSibling);
|
|
|
+ let innerDeIcon = document.getElementById('de-btn1');
|
|
|
+ if (!innerDeIcon) {
|
|
|
+ parent.parentNode.insertBefore(dom, parent.nextElementSibling);
|
|
|
+ }
|
|
|
} else {
|
|
|
setTimeout(() => {
|
|
|
parent = _getScheduleDom(isClick);
|
|
@@ -789,6 +792,7 @@ export function init() {
|
|
|
console.log('init')
|
|
|
|
|
|
getDiscordAuthCode();
|
|
|
+
|
|
|
let where = window.location.href.indexOf('twitter.com') < 0 && window.location.href.indexOf('facebook.com') < 0;
|
|
|
if (where) {
|
|
|
return
|
|
@@ -1288,36 +1292,116 @@ export const showNFTSale = () => {
|
|
|
document.querySelector('div[id="de-nft-node"]').style.display = 'block';
|
|
|
}
|
|
|
|
|
|
-export const appendPopupPage = (params) => {
|
|
|
+export const appendPopupPage = (params = {}) => {
|
|
|
let { path = '' } = params;
|
|
|
|
|
|
let iframe = document.createElement('iframe');
|
|
|
- iframe.id = 'de-popup-page';
|
|
|
- iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
|
- 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;`
|
|
|
+ iframe.id = 'de-popup-page';
|
|
|
+ iframe.src = chrome.runtime.getURL('/iframe/popup-page.html') + `#${path}`;
|
|
|
+ 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: 90000;
|
|
|
+ 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;transform: translateX(385px);`
|
|
|
let iframeContent = document.getElementById('de-popup-page');
|
|
|
- if (!iframeContent) {
|
|
|
+
|
|
|
+ let overlayDom = document.createElement('div');
|
|
|
+ overlayDom.id = 'de-popup-overlay';
|
|
|
+ overlayDom.style.cssText = `position: fixed;z-index: 88888;top: 0;
|
|
|
+ left: 0;width: 100%;height: 100%;opacity: 0;display: none`;
|
|
|
+
|
|
|
+ let overlay = document.getElementById('de-popup-overlay');
|
|
|
+ let body = document.querySelector('body');
|
|
|
+
|
|
|
+ if (!iframeContent && body) {
|
|
|
document.querySelector('body').appendChild(iframe);
|
|
|
+ if(!overlay) {
|
|
|
+ document.querySelector('body').appendChild(overlayDom);
|
|
|
+
|
|
|
+ overlayDom.addEventListener('click', function() {
|
|
|
+ hidePopupPage();
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ overlay.addEventListener('click', function() {
|
|
|
+ hidePopupPage();
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export const showPopupPage = (params) => {
|
|
|
+export const showPopupPage = (params = {}) => {
|
|
|
let { path = '' } = params;
|
|
|
hidePinTips();
|
|
|
hideNoticeBindTweet();
|
|
|
- appendPopupPage({ path });
|
|
|
+
|
|
|
+ let iframe = document.getElementById('de-popup-page');
|
|
|
+ if (iframe) {
|
|
|
+ if(path) {
|
|
|
+ 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: { }
|
|
|
+ }, () => { });
|
|
|
+
|
|
|
+ let overlay = document.getElementById('de-popup-overlay');
|
|
|
+ overlay.style.display = 'block';
|
|
|
+
|
|
|
+ let body = document.querySelector('body');
|
|
|
+ if(body) {
|
|
|
+ body.style.overflowY = 'hidden';
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export const hidePopupPage = () => {
|
|
|
let iframe = document.getElementById('de-popup-page');
|
|
|
if (iframe) {
|
|
|
- document.querySelector('body').removeChild(iframe);
|
|
|
+ iframe.style.transform = 'translateX(' + 385 + 'px)';
|
|
|
+
|
|
|
+ let overlay = document.getElementById('de-popup-overlay');
|
|
|
+ overlay.style.display = 'none';
|
|
|
+
|
|
|
+ let body = document.querySelector('body');
|
|
|
+ if(body) {
|
|
|
+ body.style.overflowY = 'auto';
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export const tiggerInjectPopupPage = () => {
|
|
|
+ let iframeContent = document.getElementById('de-popup-page');
|
|
|
+ if (iframeContent) {
|
|
|
+ hidePinTips();
|
|
|
+ hideNoticeBindTweet();
|
|
|
+ let {transform = ''} = iframeContent.style;
|
|
|
+ if(transform == 'translateX(385px)' || !transform) {
|
|
|
+ showPopupPage();
|
|
|
+ } else {
|
|
|
+ hidePopupPage();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ appendPopupPage();
|
|
|
+ setTimeout(() => {
|
|
|
+ let iframe = document.getElementById('de-popup-page');
|
|
|
+ let {transform = ''} = iframe.style;
|
|
|
+ if(transform == 'translateX(385px)' || !transform) {
|
|
|
+ showPopupPage();
|
|
|
+ } else {
|
|
|
+ hidePopupPage();
|
|
|
+ }
|
|
|
+ }, 300)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const onBodyClick = () => {
|
|
|
- document.querySelector('body').addEventListener('click', function () {
|
|
|
- hidePopupPage();
|
|
|
- })
|
|
|
+ if(window.location.href.indexOf('api.twitter.com') < 0) {
|
|
|
+ document.querySelector('body').addEventListener('click', function () {
|
|
|
+ console.log('click')
|
|
|
+ // hidePopupPage();
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|