SOURCE

javascript: (() => {
    // 创建一个 数组 存储网站链接和密码
    const siteList = {};
    function test() {
        const link = window.location.href
        if (!siteList[link]) {
            const password = prompt('请输入密码');
            if(!pass)
            siteList[link] = password

            const bookmarkCode = `
            javascript: (() => {
              // 创建一个 数组 存储网站链接和密码
              const siteList = ${JSON.stringify(siteList)}
              ${test.valueOf()}
              test()
            })()
            `
            // 打印书签代码到控制台,让用户保存
            console.log('书签代码如下,请复制并创建新的书签:\n', bookmarkCode);
            alert('快捷书签代码已生成,请打开开发者工具 (F12) 查看并复制到书签。');
        } else {
            simulateTyping('.t-input__inner', siteList[link], 200);
        }
        function simulateTyping(inputSelector, text, delay = 100) {
            const input = document.querySelector(inputSelector);

            if (!input) {
                console.error('Input element not found!');
                return;
            }
            let index = 0;
            const typeCharacter = () => {
                if (index < text.length) {
                    const char = text[index];

                    // 创建键盘事件
                    const keydownEvent = new KeyboardEvent('keydown', { key: char });
                    const inputEvent = new InputEvent('input', { bubbles: true, inputType: 'insertText', data: char });
                    const keyupEvent = new KeyboardEvent('keyup', { key: char });

                    // 触发事件
                    input.dispatchEvent(keydownEvent);
                    input.value += char; // 模拟插入字符
                    input.dispatchEvent(inputEvent);
                    input.dispatchEvent(keyupEvent);

                    index++;
                    setTimeout(typeCharacter, delay); // 模拟输入的延迟
                } else {
                    console.log('Typing simulation completed!');
                }
            };
            typeCharacter();
        };
    }
    test();
})(window)
console 命令行工具 X clear

                    
>
console