上一主题 下一主题
ScriptCat,新一代的脚本管理器脚本站,与全世界分享你的用户脚本油猴脚本开发指南教程目录
返回列表 发新帖
楼主: scgagg2012 - 

求一个自动填充的插件或者脚本

[复制链接]

该用户从未签到

1

主题

0

回帖

4

积分

助理工程师

积分
4
发表于 2024-4-23 10:46:23 | 显示全部楼层 | 阅读模式
能在用户打开的任何有填充内容要求的网页自动识别用户设定的关键字,然后输入提前设定的内容。例如抓取到关键字“我对事件的意见或看法”自动输入“非常满意”,抓取到百度一下,自动在框里输入“五年计划的实施”,
  • TA的每日心情
    开心
    2023-2-28 23:59
  • 签到天数: 191 天

    [LV.7]常住居民III

    648

    主题

    5271

    回帖

    6158

    积分

    管理员

    非物质文化遗产社会摇传承人

    积分
    6158

    荣誉开发者管理员油中2周年生态建设者喜迎中秋

    发表于 2024-4-23 12:31:31 | 显示全部楼层
    小众的基本只能靠自己开发了
    混的人。
    ------------------------------------------
    進撃!永遠の帝国の破壊虎---李恒道

    入驻了爱发电https://afdian.net/a/lihengdao666
    个人宣言:この世界で私に胜てる人とコードはまだ生まれていません。死ぬのが怖くなければ来てください。
    回复

    使用道具 举报

    该用户从未签到

    0

    主题

    16

    回帖

    10

    积分

    荣誉开发者

    积分
    10

    荣誉开发者油中3周年油中2周年

    发表于 2024-5-4 15:48:43 | 显示全部楼层
    // ==UserScript==
    // @name         AutoFill Keywords Script
    // @namespace    http://tampermonkey.net/
    // @version      1.0
    // @description  Automatically fill in predefined content based on keywords detected on the page.
    // @author       You
    // @match        *://*/*
    // @grant        none
    // ==/UserScript==

    (function() {
        'use strict';

        // Define your keywords and the corresponding content to fill
        const keywords = {
            "我对事件的意见或看法": "非常满意",
            "百度一下": "五年计划的实施"
        };

        // Function to detect keywords and autofill content
        function autoFillContent() {
            // Iterate over each keyword/content pair
            for (const [keyword, content] of Object.entries(keywords)) {
                // Check if the keyword exists on the page
                if (document.body.innerText.includes(keyword)) {
                    // Find the input field or area to fill
                    const inputField = document.querySelector('input[type="text"], textarea');
                    if (inputField) {
                        // Fill in the predefined content
                        inputField.value = content;
                        break; // Stop after the first match to prevent overwriting
                    }
                }
            }
        }

        // Run the autofill function when the page loads
        window.addEventListener('DOMContentLoaded', autoFillContent);
    })();
    這個應該可以達到你要的要求~自己測試 任何網頁都通用~~~置換你設定的內容即可
    回复

    使用道具 举报

    发表回复

    本版积分规则

    快速回复 返回顶部 返回列表