1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // 此文件不要写具体逻辑,只调用函数
- // var port = chrome.runtime.connect({
- // name: "hello",
- // });
- import {
- showGiveDialogHandler,
- showIframeHandler,
- hideIframeHandler,
- showTwitterPublishDialogHandler,
- showPinTips,
- init,
- initExecuteScript,
- changeQueueNum
- } from "@/logic/content/twitter.js";
- chrome.storage.onChanged.addListener(changes => {
- initExecuteScript(changes)
- })
- window.onload = () => {
- init()
- };
- window.onmessage = (res) => {
- if (res.data && res.data.actionType) {
- switch (res.data.actionType) {
- case "IFRAME_SHOW_IFREME":
- showIframeHandler();
- break;
- case "IFRAME_HIDE_IFREME":
- hideIframeHandler();
- break;
- case "IFRAME_SHOW_TWITTER_PUBLISH_DIALOG":
- showTwitterPublishDialogHandler(res.data.publishRes);
- break;
- // case "IFRAME_DO_TASK":
- // findTweetByIdDoTask(res.data.task_data, res.data.task_type)
- // break
- }
- }
- };
- chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
- sendResponse('')
- switch (req.actionType) {
- case 'BG_SHOW_PIN_TIPS':
- showPinTips()
- break
- case "BACK_TWITTER_LOGIN_SUCCESS":
- showGiveDialogHandler();
- break
- case 'BACK_TWITTER_SHORT_URL':
- console.log('BACK_TWITTER_SHORT_URL')
- changeQueueNum(1)
- break
- case 'TIME':
- alert('time')
- break
- }
- })
|