您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Checks grammar and spelling in text inputs (Like Grammarly Premium!)
当前为
// ==UserScript== // @name AI Grammar Checker (Grammarly Alternative) // @namespace http://tampermonkey.net/ // @version 1.0 // @description Checks grammar and spelling in text inputs (Like Grammarly Premium!) // @author You // @match *://*/* // @grant none // ==/UserScript== var GrammarChecker = {}; GrammarChecker.API_URL = "https://api.languagetool.org/v2/check"; GrammarChecker.init = function() { console.log("🚀 Grammar Checker Initialized!"); Sahin.observeElements("textarea, input[type='text'], [contenteditable='true']", function(elements) { elements.forEach(element => { if (!element.dataset.grammarChecked) { element.dataset.grammarChecked = "true"; element.addEventListener("blur", () => GrammarChecker.checkGrammar(element)); } }); }); }; GrammarChecker.checkGrammar = function(element) { let text = element.value || element.innerText; if (!text.trim()) return; console.log("📝 Checking grammar for:", text); fetch(GrammarChecker.API_URL, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: `language=en-US&text=${encodeURIComponent(text)}` }) .then(response => response.json()) .then(data => GrammarChecker.showCorrections(element, data)) .catch(error => console.error("Grammar Check Error:", error)); }; GrammarChecker.showCorrections = function(element, data) { let errors = data.matches; if (errors.length === 0) return; let suggestions = errors.map(e => `${e.message} ➝ ${e.replacements.map(r => r.value).join(", ")}`).join("\n"); let tooltip = document.createElement("div"); tooltip.className = "grammar-tooltip"; tooltip.innerText = suggestions; tooltip.style.position = "absolute"; tooltip.style.background = "#fffa65"; tooltip.style.color = "#333"; tooltip.style.border = "1px solid #f39c12"; tooltip.style.padding = "8px"; tooltip.style.zIndex = "9999"; tooltip.style.maxWidth = "300px"; tooltip.style.fontSize = "14px"; tooltip.style.top = `${element.getBoundingClientRect().bottom + window.scrollY}px`; tooltip.style.left = `${element.getBoundingClientRect().left}px`; document.body.appendChild(tooltip); setTimeout(() => tooltip.remove(), 5000); }; // Start the script GrammarChecker.init(); Sahin.injectFunctionsToPage(GrammarChecker);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址