content_help.js 837 B

1234567891011121314151617181920212223242526272829303132
  1. import {
  2. appendPopupPage,
  3. tiggerInjectPopupPage
  4. } from "@/logic/content/twitter.js";
  5. window.onload = () => {
  6. appendPopupPage();
  7. chrome.runtime.sendMessage({
  8. actionType: "CONTENT_WINDOW_LOADED_SET_POPUP_PAGE",
  9. data: { }
  10. }, () => { });
  11. };
  12. chrome.runtime.sendMessage({
  13. actionType: "CONTENT_SET_POPUP_CONFIG",
  14. data: {
  15. popup: 'popup.html'
  16. }
  17. }, () => { });
  18. chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
  19. sendResponse('')
  20. switch (req.actionType) {
  21. case 'BACK_PING':
  22. console.log('BACK_PING')
  23. chrome.runtime.sendMessage({ actionType: "CONTENT_PONG", data: '1' }, (res) => { console.log(res) })
  24. break
  25. case 'BG_INJECT_EXTENSION_POPUP':
  26. tiggerInjectPopupPage();
  27. break
  28. }
  29. })