Prechádzať zdrojové kódy

单号位数不固定

liqiuying 1 týždeň pred
rodič
commit
1542f1720f

+ 0 - 6
.history/entrypoints/content_20250803223944.ts

@@ -1,6 +0,0 @@
-export default defineContentScript({
-  matches: ['*://*.google.com/*'],
-  main() {
-    console.log('Hello content.');
-  },
-});

+ 0 - 150
.history/entrypoints/content_20250812162852.ts

@@ -1,150 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
-      if (request.action === "getImages") {
-        // 获取页面上所有图片元素
-        const images = Array.from(document.querySelectorAll('img'))
-          .map(img => ({
-            src: img.src,
-            alt: img.alt,
-            width: img.width,
-            height: img.height
-          }))
-          .filter(img => img.src);
-        
-        sendResponse({ images });
-      }
-      
-      if (request.action === "getImageById") {
-        // 根据ID获取特定图片元素
-        const imageElement = document.getElementById(request.imageId);
-        
-        if (imageElement && imageElement.tagName.toLowerCase() === 'img') {
-          const image = {
-            src: (imageElement as HTMLImageElement).src,
-            alt: (imageElement as HTMLImageElement).alt,
-            width: (imageElement as HTMLImageElement).width,
-            height: (imageElement as HTMLImageElement).height
-          };
-          sendResponse({ image });
-        } else {
-          sendResponse({ image: null });
-        }
-      }
-      
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 119
.history/entrypoints/content_20250812163221.ts

@@ -1,119 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {      
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 120
.history/entrypoints/content_20250812164221.ts

@@ -1,120 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {      
-      if (request.action === "getTbodyData") {
-        console.log(document.querySelectorAll('table'),"dddddddds")
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 121
.history/entrypoints/content_20250812164305.ts

@@ -1,121 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {  
-      console.log("rrrrrr")    
-      if (request.action === "getTbodyData") {
-        console.log(document.querySelectorAll('table'),"dddddddds")
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 132
.history/entrypoints/content_20250812164714.ts

@@ -1,132 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main(ctx) {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    const handleMessage = (request: any, sender: any, sendResponse: any) => {
-      console.log("Received message:", request);
-      
-      if (request.action === "getTbodyData") {
-        console.log(document.querySelectorAll('table'), "tables found");
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-        return true; // 保持消息通道开放
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-        return true; // 保持消息通道开放
-      }
-    };
-    
-    // 添加消息监听器
-    browser.runtime.onMessage.addListener(handleMessage);
-    
-    // 清理函数
-    ctx.onInvalidated(() => {
-      browser.runtime.onMessage.removeListener(handleMessage);
-    });
-  }
-});

+ 0 - 132
.history/entrypoints/content_20250812164814.ts

@@ -1,132 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-
-  main(ctx) {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-
-      return null;
-    };
-
-    // 监听来自popup的消息
-    const handleMessage = (request: any, sender: any, sendResponse: any) => {
-      console.log("Received message:", request);
-
-      if (request.action === "getTbodyData") {
-        console.log(document.querySelectorAll('table'), "tables found");
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-
-        sendResponse({ tables: nonEmptyTables });
-        return true; // 保持消息通道开放
-      }
-
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{ url: string, element: string, class: string, id: string }> = [];
-
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-
-        sendResponse({ backgroundImages });
-        return true; // 保持消息通道开放
-      }
-    };
-
-    // 添加消息监听器
-    browser.runtime.onMessage.addListener(handleMessage);
-
-    // 清理函数
-    ctx.onInvalidated(() => {
-      browser.runtime.onMessage.removeListener(handleMessage);
-    });
-  }
-});

+ 0 - 150
.history/entrypoints/content_20250812165154.ts

@@ -1,150 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
-      if (request.action === "getImages") {
-        // 获取页面上所有图片元素
-        const images = Array.from(document.querySelectorAll('img'))
-          .map(img => ({
-            src: img.src,
-            alt: img.alt,
-            width: img.width,
-            height: img.height
-          }))
-          .filter(img => img.src);
-        
-        sendResponse({ images });
-      }
-      
-      if (request.action === "getImageById") {
-        // 根据ID获取特定图片元素
-        const imageElement = document.getElementById(request.imageId);
-        
-        if (imageElement && imageElement.tagName.toLowerCase() === 'img') {
-          const image = {
-            src: (imageElement as HTMLImageElement).src,
-            alt: (imageElement as HTMLImageElement).alt,
-            width: (imageElement as HTMLImageElement).width,
-            height: (imageElement as HTMLImageElement).height
-          };
-          sendResponse({ image });
-        } else {
-          sendResponse({ image: null });
-        }
-      }
-      
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 150
.history/entrypoints/content_20250812165312.ts

@@ -1,150 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
-      if (request.action === "getImages") {
-        // 获取页面上所有图片元素
-        const images = Array.from(document.querySelectorAll('img'))
-          .map(img => ({
-            src: img.src,
-            alt: img.alt,
-            width: img.width,
-            height: img.height
-          }))
-          .filter(img => img.src);
-        
-        sendResponse({ images });
-      }
-      
-      if (request.action === "getImageById") {
-        // 根据ID获取特定图片元素
-        const imageElement = document.getElementById(request.imageId);
-        
-        if (imageElement && imageElement.tagName.toLowerCase() === 'img') {
-          const image = {
-            src: (imageElement as HTMLImageElement).src,
-            alt: (imageElement as HTMLImageElement).alt,
-            width: (imageElement as HTMLImageElement).width,
-            height: (imageElement as HTMLImageElement).height
-          };
-          sendResponse({ image });
-        } else {
-          sendResponse({ image: null });
-        }
-      }
-      
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 6
.history/entrypoints/content_20250812170541.ts

@@ -1,6 +0,0 @@
-export default defineContentScript({
-  matches: ['*://*.google.com/*'],
-  main() {
-    console.log('Hello content.');
-  },
-});

+ 0 - 6
.history/entrypoints/content_20250812170753.ts

@@ -1,6 +0,0 @@
-export default defineContentScript({
-  matches: ['*://*.google.com/*'],
-  main() {
-    console.log('Hello content.');
-  },
-});

+ 0 - 6
.history/entrypoints/content_20250812170800.ts

@@ -1,6 +0,0 @@
-export default defineContentScript({
-  matches: ['*://*.google.com/*'],
-  main() {
-    console.log('Hello content.');
-  },
-});

+ 0 - 85
.history/entrypoints/content_20250812171131.ts

@@ -1,85 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main(ctx) {
-    // 监听来自popup的消息
-    const handleMessage = (request: any, sender: any, sendResponse: any) => {
-      if (request.action === "getImages") {
-        try {
-          // 获取页面上所有图片元素
-          const imageElements = Array.from(document.querySelectorAll('img'));
-          
-          // 获取背景图片元素
-          const allElements = Array.from(document.querySelectorAll('*'));
-          const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-          
-          // 提取<img>标签的图片
-          const imgSources = imageElements
-            .map(img => {
-              let url = img.src;
-              // 处理相对路径
-              if (url && !url.startsWith('http') && !url.startsWith('data:')) {
-                try {
-                  url = new URL(url, window.location.origin).href;
-                } catch (e) {
-                  console.warn('Failed to resolve relative URL:', url);
-                }
-              }
-              return {
-                url,
-                element: 'img',
-                class: img.className || '',
-                id: img.id || '',
-                alt: img.alt || ''
-              };
-            })
-            .filter(img => img.url && (img.url.startsWith('http') || img.url.startsWith('data:')));
-          
-          // 提取背景图片
-          allElements.forEach(element => {
-            const computedStyle = window.getComputedStyle(element);
-            const backgroundImage = computedStyle.backgroundImage;
-            
-            // 检查是否有background-image
-            if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-              // 提取URL
-              const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-              if (urlMatch && urlMatch[1]) {
-                // 解码HTML实体
-                const textarea = document.createElement('textarea');
-                textarea.innerHTML = urlMatch[1];
-                const decodedUrl = textarea.value;
-                
-                backgroundImages.push({
-                  url: decodedUrl,
-                  element: element.tagName.toLowerCase(),
-                  class: element.className || '',
-                  id: element.id || ''
-                });
-              }
-            }
-          });
-          
-          // 合并所有图片
-          const allImages = [...imgSources, ...backgroundImages];
-          
-          sendResponse({ images: allImages });
-        } catch (error) {
-          console.error('Error extracting images:', error);
-          sendResponse({ images: [], error: error.message });
-        }
-        return true; // 保持消息通道开放
-      }
-    };
-    
-    // 添加消息监听器
-    browser.runtime.onMessage.addListener(handleMessage);
-    
-    // 清理函数
-    ctx.onInvalidated(() => {
-      browser.runtime.onMessage.removeListener(handleMessage);
-    });
-    
-    console.log('Content script loaded');
-  }
-});

+ 0 - 89
.history/entrypoints/content_20250812172518.ts

@@ -1,89 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  runAt: "document_idle", // 确保在页面加载完成后运行
-  
-  main(ctx) {
-    console.log('Content script loaded on:', window.location.href);
-    
-    // 监听来自popup的消息
-    const handleMessage = (request: any, sender: any, sendResponse: any) => {
-      console.log('Received message:', request);
-      
-      if (request.action === "getImages") {
-        try {
-          // 获取页面上所有图片元素
-          const imageElements = Array.from(document.querySelectorAll('img'));
-          
-          // 获取背景图片元素
-          const allElements = Array.from(document.querySelectorAll('*'));
-          const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-          
-          // 提取<img>标签的图片
-          const imgSources = imageElements
-            .map(img => {
-              let url = img.src;
-              // 处理相对路径
-              if (url && !url.startsWith('http') && !url.startsWith('data:')) {
-                try {
-                  url = new URL(url, window.location.origin).href;
-                } catch (e) {
-                  console.warn('Failed to resolve relative URL:', url);
-                }
-              }
-              return {
-                url,
-                element: 'img',
-                class: img.className || '',
-                id: img.id || '',
-                alt: img.alt || ''
-              };
-            })
-            .filter(img => img.url && (img.url.startsWith('http') || img.url.startsWith('data:')));
-          
-          // 提取背景图片
-          allElements.forEach(element => {
-            const computedStyle = window.getComputedStyle(element);
-            const backgroundImage = computedStyle.backgroundImage;
-            
-            // 检查是否有background-image
-            if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-              // 提取URL
-              const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-              if (urlMatch && urlMatch[1]) {
-                // 解码HTML实体
-                const textarea = document.createElement('textarea');
-                textarea.innerHTML = urlMatch[1];
-                const decodedUrl = textarea.value;
-                
-                backgroundImages.push({
-                  url: decodedUrl,
-                  element: element.tagName.toLowerCase(),
-                  class: element.className || '',
-                  id: element.id || ''
-                });
-              }
-            }
-          });
-          
-          // 合并所有图片
-          const allImages = [...imgSources, ...backgroundImages];
-          
-          console.log('Found images:', allImages);
-          sendResponse({ images: allImages });
-        } catch (error: any) {
-          console.error('Error extracting images:', error);
-          sendResponse({ images: [], error: error.message });
-        }
-        return true; // 保持消息通道开放
-      }
-    };
-    
-    // 添加消息监听器
-    browser.runtime.onMessage.addListener(handleMessage);
-    
-    // 清理函数
-    ctx.onInvalidated(() => {
-      browser.runtime.onMessage.removeListener(handleMessage);
-    });
-  }
-});

+ 0 - 95
.history/entrypoints/content_20250812172948.ts

@@ -1,95 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  runAt: "document_idle", // 确保在页面加载完成后运行
-  
-  main(ctx) {
-    console.log('Content script loaded on:', window.location.href);
-    
-    // 监听来自popup的消息
-    const handleMessage = (request: any, sender: any, sendResponse: any) => {
-      console.log('Received message:', request);
-      
-      // 处理测试消息
-      if (request.action === "test") {
-        sendResponse({ status: "success", message: "Content script is running" });
-        return true;
-      }
-      
-      if (request.action === "getImages") {
-        try {
-          // 获取页面上所有图片元素
-          const imageElements = Array.from(document.querySelectorAll('img'));
-          
-          // 获取背景图片元素
-          const allElements = Array.from(document.querySelectorAll('*'));
-          const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-          
-          // 提取<img>标签的图片
-          const imgSources = imageElements
-            .map(img => {
-              let url = img.src;
-              // 处理相对路径
-              if (url && !url.startsWith('http') && !url.startsWith('data:')) {
-                try {
-                  url = new URL(url, window.location.origin).href;
-                } catch (e) {
-                  console.warn('Failed to resolve relative URL:', url);
-                }
-              }
-              return {
-                url,
-                element: 'img',
-                class: img.className || '',
-                id: img.id || '',
-                alt: img.alt || ''
-              };
-            })
-            .filter(img => img.url && (img.url.startsWith('http') || img.url.startsWith('data:')));
-          
-          // 提取背景图片
-          allElements.forEach(element => {
-            const computedStyle = window.getComputedStyle(element);
-            const backgroundImage = computedStyle.backgroundImage;
-            
-            // 检查是否有background-image
-            if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-              // 提取URL
-              const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-              if (urlMatch && urlMatch[1]) {
-                // 解码HTML实体
-                const textarea = document.createElement('textarea');
-                textarea.innerHTML = urlMatch[1];
-                const decodedUrl = textarea.value;
-                
-                backgroundImages.push({
-                  url: decodedUrl,
-                  element: element.tagName.toLowerCase(),
-                  class: element.className || '',
-                  id: element.id || ''
-                });
-              }
-            }
-          });
-          
-          // 合并所有图片
-          const allImages = [...imgSources, ...backgroundImages];
-          
-          console.log('Found images:', allImages);
-          sendResponse({ images: allImages });
-        } catch (error: any) {
-          console.error('Error extracting images:', error);
-          sendResponse({ images: [], error: error.message });
-        }
-        return true; // 保持消息通道开放
-      }
-    };
-    
-    // 添加消息监听器
-    browser.runtime.onMessage.addListener(handleMessage);
-    
-    // 清理函数
-    ctx.onInvalidated(() => {
-      browser.runtime.onMessage.removeListener(handleMessage);
-    });
-  }
-});

+ 0 - 150
.history/entrypoints/content_20250812173322.ts

@@ -1,150 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
-      if (request.action === "getImages") {
-        // 获取页面上所有图片元素
-        const images = Array.from(document.querySelectorAll('img'))
-          .map(img => ({
-            src: img.src,
-            alt: img.alt,
-            width: img.width,
-            height: img.height
-          }))
-          .filter(img => img.src);
-        
-        sendResponse({ images });
-      }
-      
-      if (request.action === "getImageById") {
-        // 根据ID获取特定图片元素
-        const imageElement = document.getElementById(request.imageId);
-        
-        if (imageElement && imageElement.tagName.toLowerCase() === 'img') {
-          const image = {
-            src: (imageElement as HTMLImageElement).src,
-            alt: (imageElement as HTMLImageElement).alt,
-            width: (imageElement as HTMLImageElement).width,
-            height: (imageElement as HTMLImageElement).height
-          };
-          sendResponse({ image });
-        } else {
-          sendResponse({ image: null });
-        }
-      }
-      
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-      
-      if (request.action === "getBackgroundImages") {
-        // 获取所有带有background-image的元素
-        const allElements = Array.from(document.querySelectorAll('*'));
-        const backgroundImages: Array<{url: string, element: string, class: string, id: string}> = [];
-        
-        allElements.forEach(element => {
-          const computedStyle = window.getComputedStyle(element);
-          const backgroundImage = computedStyle.backgroundImage;
-          
-          // 检查是否有background-image
-          if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-            // 提取URL
-            const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-            if (urlMatch && urlMatch[1]) {
-              // 解码HTML实体
-              const textarea = document.createElement('textarea');
-              textarea.innerHTML = urlMatch[1];
-              const decodedUrl = textarea.value;
-              
-              backgroundImages.push({
-                url: decodedUrl,
-                element: element.tagName.toLowerCase(),
-                class: element.className || '',
-                id: element.id || ''
-              });
-            }
-          }
-        });
-        
-        sendResponse({ backgroundImages });
-      }
-    });
-  }
-});

+ 0 - 87
.history/entrypoints/content_20250812173637.ts

@@ -1,87 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-    });
-  }
-});

+ 0 - 87
.history/entrypoints/content_20250812173708.ts

@@ -1,87 +0,0 @@
-export default defineContentScript({
-  matches: ["<all_urls>"],
-  
-  main() {
-    // 辅助函数:提取背景图片URL
-    const extractBackgroundUrl = (element: Element): string | null => {
-      const computedStyle = window.getComputedStyle(element);
-      const backgroundImage = computedStyle.backgroundImage;
-      
-      if (backgroundImage && backgroundImage !== 'none' && backgroundImage.includes('url')) {
-        // 处理包含转义字符的URL
-        const urlMatch = backgroundImage.match(/url\(["']?(.*?)["']?\)/);
-        if (urlMatch && urlMatch[1]) {
-          // 解码HTML实体
-          let url = urlMatch[1];
-          const textarea = document.createElement('textarea');
-          textarea.innerHTML = url;
-          return textarea.value;
-        }
-      }
-      
-      return null;
-    };
-    
-    // 监听来自popup的消息
-    browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
-      if (request.action === "getTbodyData") {
-        // 获取所有tbody中的数据,包括背景图片
-        const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
-          const tbodies = Array.from(table.querySelectorAll('tbody'));
-          
-          return tbodies.map(tbody => {
-            const rows = Array.from(tbody.querySelectorAll('tr'));
-            
-            return rows.map((row, rowIndex) => {
-              const cells = Array.from(row.querySelectorAll('td, th'));
-              return cells.map((cell, cellIndex) => {
-                // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
-                
-                // 查找单元格内所有带有背景图片的div元素
-                const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))
-                  .map((div, divIndex) => {
-                    const backgroundUrl = extractBackgroundUrl(div);
-                    if (backgroundUrl) {
-                      return {
-                        url: backgroundUrl,
-                        className: div.className || '',
-                        style: div.getAttribute('style') || ''
-                      };
-                    }
-                    return null;
-                  })
-                  .filter(item => item !== null);
-                
-                // 如果找到带背景图片的div,返回包含这些信息的对象
-                if (divsWithBackground.length > 0) {
-                  return {
-                    text: textContent,
-                    backgroundImages: divsWithBackground
-                  };
-                }
-                
-                // 检查单元格本身是否有背景图片
-                const cellBackgroundUrl = extractBackgroundUrl(cell);
-                if (cellBackgroundUrl) {
-                  return {
-                    text: textContent,
-                    cellBackgroundUrl: cellBackgroundUrl
-                  };
-                }
-                
-                // 否则返回文本内容
-                return textContent;
-              });
-            });
-          }).flat();
-        }).flat();
-        
-        // 过滤掉空表格
-        const nonEmptyTables = tables.filter(table => table.length > 0);
-        
-        sendResponse({ tables: nonEmptyTables });
-      }
-    });
-  }
-});

+ 17 - 2
entrypoints/content.ts

@@ -29,7 +29,6 @@ export default defineContentScript({
         // 获取所有tbody中的数据,包括背景图片
         const tables = Array.from(document.querySelectorAll('table')).map((table, tableIndex) => {
           const tbodies = Array.from(table.querySelectorAll('tbody'));
-
           return tbodies.map(tbody => {
             const rows = Array.from(tbody.querySelectorAll('tr'));
 
@@ -37,7 +36,23 @@ export default defineContentScript({
               const cells = Array.from(row.querySelectorAll('td, th'));
               return cells.map((cell, cellIndex) => {
                 // 获取单元格文本内容
-                const textContent = cell.textContent?.trim() || '';
+                let textContent = cell.textContent?.trim() || '';
+                // 将文本中带有WB和件的判定为单号进行特殊处理,单号位数不确定
+                if (textContent.includes('WB') && textContent.includes('件')) {
+                  // 去除带"件"的span标签
+                  const spans = cell.getElementsByTagName('span');
+                  let spanValues: string[] = [];
+
+                  // 遍历所有 span 元素并提取文本值
+                  for (let i = 0; i < spans.length; i++) {
+                    const spanText = spans[i].textContent?.trim() || '';
+                    spanValues.push(spanText);
+                  }
+                  const firstTwoSpanValues = spanValues.slice(0, 2);
+                  // console.log("前两个 Span 标签的值:", firstTwoSpanValues);
+                  textContent = firstTwoSpanValues[0] || ''
+                  console.log("textContent", textContent)
+                }
 
                 // 查找单元格内所有带有背景图片的div元素
                 const divsWithBackground = Array.from(cell.querySelectorAll('div[style*="background-image"]'))

+ 2 - 1
entrypoints/popup/pages/DesignPic.tsx

@@ -253,7 +253,8 @@ export default function DesignPic() {
           tables_arr.forEach(item => {
             let order_no = "", data_params: any[] = [], pre_info = {};
             if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
+              // order_no = item.order_no.substring(0, 15); // 取前15位
+              order_no = item.order_no
             }
             if (order_no) {
               let pre_pic = ""