您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Analyzes webpage inputs, outputs results in overlay, and allows download
当前为
// ==UserScript== // @name Webpage Content Analyzer with Button // @namespace http://tampermonkey.net/ // @version 1.1 // @license MIT // @author SijosxStudio // @url https://gf.qytechs.cn/en/users/1375139-sijosxstudio // @description Analyzes webpage inputs, outputs results in overlay, and allows download // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; // Helper function to check if text is JavaScript code function isJavaScriptCode(text) { const codeIndicators = ["function", "var", "let", "const", "=>", "return", "if", "else", "{", "}"]; return codeIndicators.some(indicator => text.includes(indicator)); } // Function to validate and fix simple JavaScript code function validateAndFixCode(code) { try { new Function(code); // Basic syntax check return code; } catch (e) { return "// Syntax Error Fixed: " + e.message + "\n" + code.replace(/;(?=\s*;)/g, ""); // Removes duplicate semicolons } } // Function to summarize text while keeping key details function summarizeText(text) { return text.length > 100 ? text.slice(0, 97) + "..." : text; } // Function to crawl the page and analyze inputs function analyzePage() { let output = ""; const inputs = document.querySelectorAll("input, textarea"); inputs.forEach(input => { let value = input.value.trim(); if (!value) return; if (isJavaScriptCode(value)) { value = validateAndFixCode(value); output += `\n\nCode:\n${value}`; } else { const summary = summarizeText(value); output += `\n\nText Summary:\n${summary}`; } }); return output; } // Function to download analyzed content as .txt file function downloadAsTextFile(content, filename = "webpage_analysis.txt") { const blob = new Blob([content], { type: "text/plain" }); const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = filename; link.click(); } // Function to create the overlay UI function createOverlay(content) { // Overlay container const overlay = document.createElement("div"); overlay.id = "analyze-overlay"; overlay.style.position = "fixed"; overlay.style.top = "0"; overlay.style.left = "0"; overlay.style.width = "100%"; overlay.style.height = "100%"; overlay.style.backgroundColor = "rgba(0, 0, 0, 0.8)"; overlay.style.color = "#fff"; overlay.style.padding = "20px"; overlay.style.overflowY = "auto"; overlay.style.zIndex = "10000"; // Close button const closeButton = document.createElement("button"); closeButton.innerText = "X"; closeButton.style.position = "absolute"; closeButton.style.top = "10px"; closeButton.style.right = "10px"; closeButton.style.fontSize = "20px"; closeButton.style.color = "#fff"; closeButton.style.backgroundColor = "transparent"; closeButton.style.border = "none"; closeButton.style.cursor = "pointer"; closeButton.onclick = () => document.body.removeChild(overlay); // Textarea to display content const textArea = document.createElement("textarea"); textArea.style.width = "100%"; textArea.style.height = "80%"; textArea.style.backgroundColor = "#333"; textArea.style.color = "#fff"; textArea.style.padding = "10px"; textArea.style.border = "1px solid #555"; textArea.style.borderRadius = "5px"; textArea.value = content; // Download button const downloadButton = document.createElement("button"); downloadButton.innerText = "Download Analysis"; downloadButton.style.marginTop = "10px"; downloadButton.style.padding = "10px 15px"; downloadButton.style.backgroundColor = "#007AFF"; downloadButton.style.color = "#fff"; downloadButton.style.border = "none"; downloadButton.style.borderRadius = "5px"; downloadButton.style.cursor = "pointer"; downloadButton.onclick = () => downloadAsTextFile(content); // Append elements to overlay overlay.appendChild(closeButton); overlay.appendChild(textArea); overlay.appendChild(downloadButton); document.body.appendChild(overlay); } // Function to handle the analysis process function startAnalysis() { const analyzedContent = analyzePage(); createOverlay(analyzedContent || "No inputs to analyze."); } // Create the analysis button const analyzeButton = document.createElement("button"); analyzeButton.innerText = "Analyze Page"; analyzeButton.style.position = "fixed"; analyzeButton.style.bottom = "20px"; analyzeButton.style.right = "20px"; analyzeButton.style.padding = "10px 15px"; analyzeButton.style.backgroundColor = "#007AFF"; analyzeButton.style.color = "#fff"; analyzeButton.style.border = "none"; analyzeButton.style.borderRadius = "5px"; analyzeButton.style.cursor = "pointer"; analyzeButton.style.zIndex = "1000"; analyzeButton.onclick = startAnalysis; // Add button to the page document.body.appendChild(analyzeButton); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址