🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Website Text Editor

Lets you click any text on any website and edit it like Inspect Element.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         Website Text Editor
// @namespace    https://ember2819.dev
// @version      1.0
// @description  Lets you click any text on any website and edit it like Inspect Element.
// @author       Ember2819
// @match        *://*/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // --- Floating Menu ---
    const menu = document.createElement("div");
    menu.style.position = "fixed";
    menu.style.top = "20px";
    menu.style.right = "20px";
    menu.style.zIndex = "999999";
    menu.style.background = "rgba(20,20,20,0.9)";
    menu.style.color = "#fff";
    menu.style.padding = "12px 15px";
    menu.style.borderRadius = "10px";
    menu.style.fontFamily = "Arial";
    menu.style.boxShadow = "0 4px 10px rgba(0,0,0,0.3)";
    menu.style.cursor = "pointer";
    menu.textContent = "Editor: OFF";
    document.body.append(menu);

    let enabled = false;

    // --- Highlight box ---
    const highlight = document.createElement("div");
    highlight.style.position = "absolute";
    highlight.style.border = "2px dashed #00e1ff";
    highlight.style.pointerEvents = "none";
    highlight.style.zIndex = "999998";
    highlight.style.display = "none";
    document.body.append(highlight);

    let currentTarget = null;

    // --- Toggle mod mode ---
    menu.addEventListener("click", () => {
        enabled = !enabled;
        menu.textContent = enabled ? "Editor: ON" : "Editor: OFF";
        highlight.style.display = enabled ? "block" : "none";
    });

    // --- Mouse tracking for highlighting ---
    document.addEventListener("mousemove", (e) => {
        if (!enabled) return;

        const el = document.elementFromPoint(e.clientX, e.clientY);
        if (!el || el === menu) return;

        currentTarget = el;
        const rect = el.getBoundingClientRect();

        highlight.style.top = rect.top + "px";
        highlight.style.left = rect.left + "px";
        highlight.style.width = rect.width + "px";
        highlight.style.height = rect.height + "px";
    });

    // --- Click to edit text ---
    document.addEventListener("click", (e) => {
        if (!enabled) return;
        if (e.target === menu) return;
        e.preventDefault();
        e.stopPropagation();

        const newText = prompt("Enter new text:", e.target.innerText);
        if (newText !== null) {
            e.target.innerText = newText;
        }
    }, true);

})();