|
@@ -1,5 +1,5 @@
|
|
/* eslint-disable */
|
|
/* eslint-disable */
|
|
-import { getChromeStorage, setChromeStorage,LANDING_PAGE } from '../uilts/chromeExtension.js'
|
|
|
|
|
|
+import { getChromeStorage, setChromeStorage, LANDING_PAGE } from '../uilts/chromeExtension.js'
|
|
import { getTtwitterRequestToken, twitterLogin } from '../server/twitter.js'
|
|
import { getTtwitterRequestToken, twitterLogin } from '../server/twitter.js'
|
|
import { srcPublishSuccess } from '../http/publishApi'
|
|
import { srcPublishSuccess } from '../http/publishApi'
|
|
|
|
|
|
@@ -42,26 +42,26 @@ export function backTwitterPinLoginCode(code) {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
chrome.cookies.getAll(LANDING_PAGE, (e = []) => {
|
|
chrome.cookies.getAll(LANDING_PAGE, (e = []) => {
|
|
- let _str = '[]'
|
|
|
|
- if (e.length > 0) {
|
|
|
|
- _str = e[0].value
|
|
|
|
- }
|
|
|
|
- let _arr = JSON.parse(decodeURIComponent(_str))
|
|
|
|
- let receivedIds = []
|
|
|
|
- if (_arr.length > 0) {
|
|
|
|
- for (let i in _arr) {
|
|
|
|
- receivedIds.push(_arr[i].receivedId)
|
|
|
|
- }
|
|
|
|
|
|
+ let _str = '[]'
|
|
|
|
+ if (e.length > 0) {
|
|
|
|
+ _str = e[0].value
|
|
|
|
+ }
|
|
|
|
+ let _arr = JSON.parse(decodeURIComponent(_str))
|
|
|
|
+ let receivedIds = []
|
|
|
|
+ if (_arr.length > 0) {
|
|
|
|
+ for (let i in _arr) {
|
|
|
|
+ receivedIds.push(_arr[i].receivedId)
|
|
}
|
|
}
|
|
- // 发送请求
|
|
|
|
- // token,code
|
|
|
|
- twitterLogin(authToken, code, receivedIds).then(res => {
|
|
|
|
- if (res.code == 0) {
|
|
|
|
- setChromeStorage({ userInfo: JSON.stringify(res.data) })
|
|
|
|
- chrome.cookies.remove(LANDING_PAGE)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
|
|
+ // 发送请求
|
|
|
|
+ // token,code
|
|
|
|
+ twitterLogin(authToken, code, receivedIds).then(res => {
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
+ setChromeStorage({ userInfo: JSON.stringify(res.data) })
|
|
|
|
+ chrome.cookies.remove(LANDING_PAGE)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
)
|
|
)
|
|
|
|
|
|
}
|
|
}
|
|
@@ -315,13 +315,13 @@ function _createBtnDom(port) {
|
|
loadingImg.src = require("../assets/img/icon-btn-loading.png");
|
|
loadingImg.src = require("../assets/img/icon-btn-loading.png");
|
|
loadingImg.style.cssText = 'width:20px;height: 20px;margin-right:3px;-webkit-animation:load 1.1s infinite linear;';
|
|
loadingImg.style.cssText = 'width:20px;height: 20px;margin-right:3px;-webkit-animation:load 1.1s infinite linear;';
|
|
|
|
|
|
- let style = document.createElement('style');
|
|
|
|
- style.innerHTML=" @-webkit-keyframes load{from{ transform: rotate(0deg);} to{transform: rotate(360deg);}}";
|
|
|
|
- document.getElementsByTagName('head').item(0).appendChild(style);
|
|
|
|
|
|
+ let style = document.createElement('style');
|
|
|
|
+ style.innerHTML = " @-webkit-keyframes load{from{ transform: rotate(0deg);} to{transform: rotate(360deg);}}";
|
|
|
|
+ document.getElementsByTagName('head').item(0).appendChild(style);
|
|
|
|
|
|
let deBtn = document.createElement('span');
|
|
let deBtn = document.createElement('span');
|
|
const shadowDiv = document.createElement('div');
|
|
const shadowDiv = document.createElement('div');
|
|
- deBtn.innerHTML = '<span>DeNet</span>';
|
|
|
|
|
|
+ deBtn.innerHTML = '<span>DeNet</span>';
|
|
deBtn.id = 'de-btn';
|
|
deBtn.id = 'de-btn';
|
|
deBtn.style.cssText = 'width:220px;height: 52px;text-align:center;line-height:52px;margin-bottom: 4px;margin-top: 4px;background: linear-gradient(274.8deg, #FF9900 -3.69%, #BD00FF 69.71%, #00F0FF 122.65%);color:#fff;font-size:15px;font-weight:700;border-radius:100px;cursor: pointer;display: flex;align-items: center;justify-content: center;';
|
|
deBtn.style.cssText = 'width:220px;height: 52px;text-align:center;line-height:52px;margin-bottom: 4px;margin-top: 4px;background: linear-gradient(274.8deg, #FF9900 -3.69%, #BD00FF 69.71%, #00F0FF 122.65%);color:#fff;font-size:15px;font-weight:700;border-radius:100px;cursor: pointer;display: flex;align-items: center;justify-content: center;';
|
|
|
|
|
|
@@ -400,7 +400,11 @@ function replaceDOMRedPacket(_dom, postId) {
|
|
if (!_dom || _dom.querySelector('iframe')) {
|
|
if (!_dom || _dom.querySelector('iframe')) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- _dom.innerHTML = ''
|
|
|
|
|
|
+ let _len = _dom.childNodes.length
|
|
|
|
+ for (let i = 0; i < _len; i++) {
|
|
|
|
+ _dom.children[i].style.display = 'none'
|
|
|
|
+ }
|
|
|
|
+
|
|
let _iframe = document.createElement('iframe')
|
|
let _iframe = document.createElement('iframe')
|
|
_iframe.id = postId
|
|
_iframe.id = postId
|
|
_iframe.src = chrome.runtime.getURL('/iframe/red-packet.html') + '?postId=' + postId;
|
|
_iframe.src = chrome.runtime.getURL('/iframe/red-packet.html') + '?postId=' + postId;
|