Procházet zdrojové kódy

Merge branch 'master' of http://787255.xyz:4003/ydm/chrome-plugin

whc před 9 měsíci
rodič
revize
a420b41416
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      content.js

+ 6 - 1
content.js

@@ -55,6 +55,8 @@ const observer = new MutationObserver((mutations) => {
     if (mutation.type === "childList") {
       mutation.addedNodes.forEach((node) => {
         if (node.nodeName === "SCRIPT" && node.src) {
+          const url = new URL(node.src);
+          if (url.pathname.startsWith("/lib")) return;
           jsRequests.add(node.src);
         }
       });
@@ -69,6 +71,8 @@ observer.observe(document, { childList: true, subtree: true });
 const scripts = Array.from(document.getElementsByTagName("script"));
 scripts.forEach((script) => {
   if (script.src) {
+    const url = new URL(script.src);
+    if (url.pathname.startsWith("/lib")) return;
     jsRequests.add(script.src);
   }
 });
@@ -76,8 +80,9 @@ scripts.forEach((script) => {
 let isOpen = false;
 
 function clickHandler(e) {
-  chrome.runtime.sendMessage({ action: "show_popup", data: "打开新页面" });
   console.log(jsRequests);
+  console.log(oldTarget);
+  chrome.runtime.sendMessage({ action: "show_popup", data: "打开新页面" });
 }
 
 // window.addEventListener("click", function (e) {