全国统一规范电子税务局税号填写辅助工具

在电子税务局旁边显示一个小窗口,方便登录(不可用)不同的公司,支持开关控制是否自动填写账号密码,新增侧边收起展开和窗口大小调整功能

目前為 2025-08-18 提交的版本,檢視 最新版本

// ==UserScript==
// @name         全国统一规范电子税务局税号填写辅助工具
// @namespace    http://tampermonkey.net/
// @version      2.3
// @description  在电子税务局旁边显示一个小窗口,方便登录(不可用)不同的公司,支持开关控制是否自动填写账号密码,新增侧边收起展开和窗口大小调整功能
// @author       Herohub
// @match        https://*.chinatax.gov.cn:8443/*
// @license      MIT
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function () {
    'use strict';

    // 判断是否为登录(不可用)页面,若不是则直接退出脚本执行
    const isLoginPage = window.location.href.includes('login?redirect_uri');
    if (!isLoginPage) return;

    // 创建浮窗元素并设置样式
    const createFloatWindow = () => {
        const floatWindow = document.createElement('div');
        Object.assign(floatWindow.style, {
            position: 'fixed',
            top: '50%',
            right: '0', // 贴紧右侧
            transform: 'translateY(-50%)',
            background: '#fff',
            border: '1px solid #ccc',
            padding: '15px',
            borderRadius: '8px 0 0 8px', // 左侧圆角,右侧直角
            boxShadow: '0 4px 8px rgba(0,0,0,.1)',
            fontFamily: 'Arial,sans-serif',
            zIndex: 10000,
            overflow: 'hidden',
            transition: 'width 0.3s cubic-bezier(0.4, 0, 0.2, 1)' // 更平滑的宽度变化动画
        });
        return floatWindow;
    };

    const floatWindow = createFloatWindow();
    document.body.appendChild(floatWindow);

    // 创建左侧调整宽度的手柄
    const leftResizeHandle = document.createElement('div');
    Object.assign(leftResizeHandle.style, {
        position: 'absolute',
        top: '0',
        left: '0',
        width: '5px',
        height: '100%',
        cursor: 'ew-resize',
        background: 'transparent',
        zIndex: 10,
        display: 'none',
        transition: 'background 0.2s ease'
    });
    leftResizeHandle.title = '拖动调整宽度';
    floatWindow.appendChild(leftResizeHandle);

    // 创建按钮元素并设置样式和点击事件
    const createButton = (text, clickHandler, isDelete = false, customStyles = {}) => {
        const button = document.createElement('button');
        const styles = {
            marginRight: '5px',
            padding: '5px 10px',
            border: 'none',
            borderRadius: '3px',
            background: isDelete? '#dc3545' : '#007BFF',
            color: '#fff',
            cursor: 'pointer',
            transition: 'background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease',
           ...customStyles
        };
        Object.assign(button.style, styles);
        button.textContent = text;
        button.addEventListener('click', clickHandler);
        // 鼠标悬停效果
        button.addEventListener('mouseover', () => {
            button.style.background = isDelete? '#c82333' : '#0056b3';
            button.style.transform = 'translateY(-1px)';
            button.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
        });
        button.addEventListener('mouseout', () => {
            button.style.background = isDelete? '#dc3545' : '#007BFF';
            button.style.transform = 'translateY(0)';
            button.style.boxShadow = 'none';
        });
        return button;
    };

    // 创建拖动按钮
    const createDragButton = () => {
        const dragButton = document.createElement('button');
        Object.assign(dragButton.style, {
            marginRight: '5px',
            padding: '2px 6px',
            border: '1px solid #ddd',
            borderRadius: '3px',
            background: '#f8f9fa',
            color: '#6c757d',
            cursor: 'grab',
            fontSize: '12px',
            transition: 'all 0.2s ease'
        });
        dragButton.innerHTML = '☰'; // 汉堡图标作为拖动指示器
        dragButton.title = '拖动调整顺序';
        
        // 拖动时改变样式
        dragButton.addEventListener('mousedown', () => {
            dragButton.style.cursor = 'grabbing';
            dragButton.style.background = '#e9ecef';
            dragButton.style.transform = 'scale(1.1)';
        });
        
        dragButton.addEventListener('mouseup', () => {
            dragButton.style.cursor = 'grab';
            dragButton.style.background = '#f8f9fa';
            dragButton.style.transform = 'scale(1)';
        });
        
        dragButton.addEventListener('mouseover', () => {
            if (dragButton.style.cursor!== 'grabbing') {
                dragButton.style.background = '#e9ecef';
                dragButton.style.transform = 'scale(1.05)';
            }
        });
        
        dragButton.addEventListener('mouseout', () => {
            if (dragButton.style.cursor!== 'grabbing') {
                dragButton.style.background = '#f8f9fa';
                dragButton.style.transform = 'scale(1)';
            }
        });
        
        return dragButton;
    };

    // 定义全局变量 - 合并窗口宽度变量,只保留一个
    let isEditMode = false;
    let lastSelectedItem = GM_getValue('lastSelectedItem', null);
    let originalWidth = null;
    // 只保留一个窗口宽度变量
    let windowWidth = GM_getValue('windowWidth', 450); // 统一窗口宽度
    let isAutoFillAccount = GM_getValue('isAutoFillAccount', false);
    let accountInfo = GM_getValue('accountInfo', null);
    // 从存储读取收起状态,默认不收起
    let isCollapsed = GM_getValue('isCollapsed', false); 
    let isInitialLoad = true; // 标记是否为初始加载
    // 拖动相关变量
    let draggedItem = null;
    let initialY = 0;
    let initialOffsetY = 0;
    
    // 收起/展开按钮 - 修复层级问题,降低z-index
    const toggleCollapseButton = document.createElement('div');
    Object.assign(toggleCollapseButton.style, {
        position: 'fixed',
        right: isCollapsed? '0' : windowWidth + 'px',
        top: '50%',
        transform: 'translateY(-50%)',
        width: '40px',
        height: '80px',
        background: '#2196F3',
        color: '#ffffff',
        border: '2px solid #0b7dda',
        borderRadius: '8px 0 0 8px',
        cursor: 'pointer',
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        boxShadow: '-3px 0 6px rgba(0,0,0,0.2)',
        zIndex: 9999, // 降低z-index,确保在模态框下方
        fontSize: '24px',
        fontWeight: 'bold',
        transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
        opacity: '1',
        pointerEvents: 'auto'
    });
    
    // 根据存储的状态设置初始箭头
    toggleCollapseButton.innerHTML = isCollapsed? '≫' : '≪';
    toggleCollapseButton.addEventListener('click', toggleCollapse);
    
    // 添加悬停效果
    toggleCollapseButton.addEventListener('mouseover', () => {
        toggleCollapseButton.style.background = '#0b7dda';
        toggleCollapseButton.style.transform = `translateY(-50%) scale(1.1)`;
    });
    
    toggleCollapseButton.addEventListener('mouseout', () => {
        toggleCollapseButton.style.background = '#2196F3';
        toggleCollapseButton.style.transform = 'translateY(-50%) scale(1)';
    });
    
    document.body.appendChild(toggleCollapseButton);

    // 主内容容器
    const mainContent = document.createElement('div');
    // 根据存储的状态设置初始显示
    mainContent.style.display = isCollapsed? 'none' : 'block';
    floatWindow.appendChild(mainContent);

    // 添加按钮
    const addButton = createButton('添加', addItem);
    mainContent.appendChild(addButton);

    // 编辑/完成按钮 - 使用更明确的变量名
    let editToggleButton = createButton('编辑', toggleEditMode);
    mainContent.appendChild(editToggleButton);

    // 导入按钮
    const importButton = createButton('导入', importData);
    importButton.style.display = 'none';
    mainContent.appendChild(importButton);

    // 导出按钮
    const exportButton = createButton('导出', exportData);
    exportButton.style.display = 'none';
    mainContent.appendChild(exportButton);

    // 账号自动填写开关按钮
    const accountAutoFillSwitch = createButton(
        isAutoFillAccount? '自动填账号密码: 开' : '自动填账号密码: 关', 
        toggleAccountAutoFill,
        false,
        { flexGrow: 1, marginLeft: '5px' }
    );
    mainContent.appendChild(accountAutoFillSwitch);

    // 分割线
    const separator = document.createElement('hr');
    separator.style.cssText = 'margin:15px 0;border:none;border-top:1px solid #e0e0e0';
    mainContent.appendChild(separator);

    // 内容列表容器 - 添加明确的类名
    const itemList = document.createElement('div');
    itemList.className = 'item-list-container';
    // 添加过渡效果,使其他条目移动更平滑
    itemList.style.transition = 'all 0.2s ease';
    mainContent.appendChild(itemList);
    
    // 设置左侧调整功能
    setupLeftResizeFunctionality();

    // 修复bug1:初始应用收起状态样式,避免刷新出现小白条和宽度异常
    if (isCollapsed) {
        floatWindow.style.width = '0px';
        floatWindow.style.padding = '0'; // 收起时移除内边距
    } else {
        // 应用统一的窗口宽度
        floatWindow.style.width = windowWidth + 'px';
    }

    // 加载已保存的税号内容
    const savedItems = GM_getValue('autoFillItems', []);
    // 确保每个条目都正确添加并初始化
    savedItems.forEach(item => {
        addItemToWindow(item.content, item.note, itemList);
    });

    // 收起/展开功能,保存状态到存储
    function toggleCollapse() {
        isCollapsed =!isCollapsed;
        // 保存状态到存储
        GM_setValue('isCollapsed', isCollapsed);
        
        if (isCollapsed) {
            // 收起状态:隐藏窗口内容但保持按钮可见
            mainContent.style.display = 'none';
            floatWindow.style.width = '0px';
            floatWindow.style.padding = '0'; // 收起时移除内边距,解决小白条问题
            toggleCollapseButton.innerHTML = '≫';
            toggleCollapseButton.style.right = '0';
        } else {
            // 展开状态:恢复窗口,使用统一宽度
            mainContent.style.display = 'block';
            floatWindow.style.width = windowWidth + 'px';
            floatWindow.style.padding = '15px'; // 恢复内边距
            toggleCollapseButton.innerHTML = '≪';
            toggleCollapseButton.style.right = windowWidth + 'px';
        }
    }

    // 左侧边缘调整宽度功能
    function setupLeftResizeFunctionality() {
        let isResizing = false;
        let startX, startWidth;

        leftResizeHandle.addEventListener('mousedown', (e) => {
            if (!isEditMode || isCollapsed) return;
            
            isResizing = true;
            startX = e.clientX;
            startWidth = parseFloat(getComputedStyle(floatWindow).width);
            
            // 调整鼠标样式和窗口过渡效果
            document.body.style.cursor = 'ew-resize';
            floatWindow.style.transition = 'none';
            
            // 添加临时样式表示正在调整
            leftResizeHandle.style.background = 'rgba(0, 123, 255, 0.3)';
            
            document.addEventListener('mousemove', resize);
            document.addEventListener('mouseup', stopResize);
        });

        function resize(e) {
            if (!isResizing) return;
            e.preventDefault();
            
            // 计算新宽度 (鼠标移动距离 + 原始宽度)
            // 由于窗口在右侧,鼠标向左移动增加宽度,向右移动减少宽度
            const widthDiff = startX - e.clientX;
            const newWidth = Math.max(400, startWidth + widthDiff);
            
            floatWindow.style.width = `${newWidth}px`;
            
            // 调整收起/展开按钮位置
            if (!isCollapsed) {
                toggleCollapseButton.style.right = newWidth + 'px';
            }
        }

        function stopResize() {
            isResizing = false;
            document.body.style.cursor = '';
            floatWindow.style.transition = '';
            leftResizeHandle.style.background = 'transparent';
            
            document.removeEventListener('mousemove', resize);
            document.removeEventListener('mouseup', stopResize);
            
            // 更新并保存统一的窗口宽度
            windowWidth = parseFloat(getComputedStyle(floatWindow).width);
            GM_setValue('windowWidth', windowWidth);
        }
    }

    // 添加新条目函数
    function addItem() {
        const modal = createAddModal();
        document.body.appendChild(modal);
    }

    // 创建添加新条目模态框
    function createAddModal() {
        const modal = document.createElement('div');
        Object.assign(modal.style, {
            position: 'fixed',
            top: '50%',
            left: '50%',
            transform: 'translate(-50%, -50%)',
            background: '#fff',
            border: '1px solid #ccc',
            padding: '20px',
            borderRadius: '8px',
            boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
            zIndex: 10001,
            display: 'flex',
            flexDirection: 'column',
            gap: '10px',
            width: '300px',
            // 添加模态框显示动画
            opacity: '0',
            transform: 'translate(-50%, -50%) scale(0.95)',
            transition: 'opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
        });
        
        // 添加模态框背景遮罩
        const overlay = document.createElement('div');
        Object.assign(overlay.style, {
            position: 'fixed',
            top: '0',
            left: '0',
            right: '0',
            bottom: '0',
            background: 'rgba(0,0,0,0.5)',
            zIndex: 10000,
            opacity: '0',
            transition: 'opacity 0.3s ease'
        });
        document.body.appendChild(overlay);
        
        // 触发动画
        setTimeout(() => {
            modal.style.opacity = '1';
            modal.style.transform = 'translate(-50%, -50%) scale(1)';
            overlay.style.opacity = '0.5';
        }, 10);

        const taxNumberInput = document.createElement('input');
        taxNumberInput.placeholder = '请输入税号';
        taxNumberInput.style.padding = '8px';
        taxNumberInput.style.border = '1px solid #ccc';
        taxNumberInput.style.borderRadius = '3px';
        taxNumberInput.style.transition = 'border-color 0.2s ease';
        taxNumberInput.addEventListener('focus', () => {
            taxNumberInput.style.borderColor = '#007BFF';
            taxNumberInput.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        taxNumberInput.addEventListener('blur', () => {
            taxNumberInput.style.borderColor = '#ccc';
            taxNumberInput.style.boxShadow = 'none';
        });
        modal.appendChild(taxNumberInput);

        const noteInput = document.createElement('input');
        noteInput.placeholder = '请输入备注';
        noteInput.style.padding = '8px';
        noteInput.style.border = '1px solid #ccc';
        noteInput.style.borderRadius = '3px';
        noteInput.style.transition = 'border-color 0.2s ease';
        noteInput.addEventListener('focus', () => {
            noteInput.style.borderColor = '#007BFF';
            noteInput.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        noteInput.addEventListener('blur', () => {
            noteInput.style.borderColor = '#ccc';
            noteInput.style.boxShadow = 'none';
        });
        modal.appendChild(noteInput);

        const confirmButton = createButton('确认', () => {
            const taxNumber = taxNumberInput.value.trim();
            const note = noteInput.value.trim();
            if (!taxNumber ||!note) {
                alert('税号和备注都不能为空,请重新输入。');
                return;
            }
            addItemToWindow(taxNumber, note, itemList);
            const items = GM_getValue('autoFillItems', []);
            items.push({ content: taxNumber, note });
            GM_setValue('autoFillItems', items);
            
            // 关闭动画
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        });
        modal.appendChild(confirmButton);

        const cancelButton = createButton('取消', () => {
            // 关闭动画
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        }, true);
        modal.appendChild(cancelButton);

        // 点击遮罩关闭模态框
        overlay.addEventListener('click', () => {
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        });

        return modal;
    }

    // 在主文档和 iframe 中查找输入框
    function findInputInIframes(selector) {
        const iframes = document.querySelectorAll('iframe');
        for (let i = 0; i < iframes.length; i++) {
            try {
                const input = iframes[i].contentDocument.querySelector(selector);
                if (input) {
                    return input;
                }
            } catch (e) {
                continue;
            }
        }
        return document.querySelector(selector);
    }

    // 将新条目添加到窗口列表中
    function addItemToWindow(content, note, container) {
        const itemDiv = document.createElement('div');
        itemDiv.className = 'tax-item'; // 添加类名便于选择
        Object.assign(itemDiv.style, {
            padding: '8px 0',
            cursor: 'pointer',
            borderBottom: '1px solid #f0f0f0',
            transition: 'background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease',
            userSelect: 'none',
            display: 'flex',
            alignItems: 'center',
            justifyContent: 'space-between',
            gap: '5px',
            // 初始添加时的淡入效果
            opacity: '0',
            transform: 'translateY(5px)'
        });
        
        // 触发淡入动画
        setTimeout(() => {
            itemDiv.style.opacity = '1';
            itemDiv.style.transform = 'translateY(0)';
        }, 50);

        // 创建拖动按钮容器(默认隐藏)
        const dragContainer = document.createElement('div');
        dragContainer.className = 'drag-container';
        dragContainer.style.display = 'none';
        const dragButton = createDragButton();
        dragContainer.appendChild(dragButton);
        itemDiv.appendChild(dragContainer);

        const textSpan = document.createElement('span');
        textSpan.textContent = note;
        textSpan.style.flexGrow = 1;
        textSpan.style.overflow = 'hidden';
        textSpan.style.textOverflow = 'ellipsis';
        textSpan.style.whiteSpace = 'nowrap';
        itemDiv.appendChild(textSpan);

        // 明确创建编辑和删除按钮容器,确保两个按钮都能正确显示
        const buttonContainer = document.createElement('div');
        buttonContainer.className = 'action-buttons';
        buttonContainer.style.display = 'flex'; // 使用flex布局确保按钮并排显示
        
        // 编辑按钮 - 增加更明确的样式和选择器
        const editBtn = createButton(
            '编辑', 
            () => editItem(itemDiv, content, note), 
            false, 
            { padding: '3px 8px', fontSize: '12px', marginRight: '3px' }
        );
        editBtn.className = 'edit-btn'; // 添加类名用于选择
        editBtn.style.display = 'none';
        
        // 删除按钮
        const deleteBtn = createButton(
            '删除', 
            () => deleteItem(itemDiv, content), 
            true, 
            { padding: '3px 8px', fontSize: '12px' }
        );
        deleteBtn.className = 'delete-btn'; // 添加类名用于选择
        deleteBtn.style.display = 'none';
        
        buttonContainer.appendChild(editBtn);
        buttonContainer.appendChild(deleteBtn);
        itemDiv.appendChild(buttonContainer);

        // 点击条目文本区域才填充税号
        textSpan.addEventListener('click', () => {
            if (isEditMode) return; // 编辑模式下点击文本不填充
            
            setTimeout(() => {
                const taxInput = findInputInIframes('input.el-input__inner[placeholder="统一社会信用代码/纳税人识别号"]');
                if (taxInput) {
                    taxInput.value = content;
                    triggerInputEvents(taxInput);
                } else {
                    console.error('未找到纳税人识别号输入框,请检查页面元素。');
                }

                if (isAutoFillAccount && accountInfo) {
                    const accountInput = findInputInIframes('input[placeholder="居民身份证号码/手机号码/用户名"]');
                    const passwordInput = findInputInIframes('input[placeholder="个人用户密码"]');
                    if (accountInput) {
                        accountInput.value = accountInfo.account;
                        triggerInputEvents(accountInput);
                    }
                    if (passwordInput) {
                        passwordInput.value = accountInfo.password;
                        triggerInputEvents(passwordInput);
                    }
                }

                clearSelection();
                itemDiv.style.background = '#e0f7fa';
                lastSelectedItem = content;
                GM_setValue('lastSelectedItem', lastSelectedItem);
            }, 500);
        });

        itemDiv.addEventListener('mouseover', () => {
            if (itemDiv.dataset.content!== lastSelectedItem) {
                itemDiv.style.background = '#f9f9f9';
            }
        });
        
        itemDiv.addEventListener('mouseout', () => {
            if (itemDiv.dataset.content!== lastSelectedItem) {
                itemDiv.style.background = '#fff';
            }
        });

        itemDiv.dataset.content = content;
        container.appendChild(itemDiv);

        // 设置拖动相关属性和事件
        setupDragItem(itemDiv, dragButton);

        if (content === lastSelectedItem) {
            itemDiv.style.background = '#e0f7fa';
        }
        
        return itemDiv; // 返回创建的元素便于调试
    }

    // 设置拖动功能
    function setupDragItem(itemDiv, dragButton) {
        let isDragging = false;
        const dragContainer = dragButton.parentElement;
        let originalRect = null;
        let originalIndex = 0;
        
        // 拖动开始
        dragButton.addEventListener('mousedown', (e) => {
            if (!isEditMode) return;
            e.stopPropagation(); // 防止触发文本点击事件
            
            // 记录初始位置和索引
            originalRect = itemDiv.getBoundingClientRect();
            const items = Array.from(itemList.querySelectorAll('.tax-item'));
            originalIndex = items.indexOf(itemDiv);
            
            isDragging = true;
            draggedItem = itemDiv;
            draggedItem.classList.add('dragging');
            
            // 记录初始鼠标位置和偏移量
            initialY = e.clientY;
            initialOffsetY = e.clientY - originalRect.top;
            
            // 设置拖动时的样式
            draggedItem.style.opacity = '0.9';
            draggedItem.style.transform = 'scale(1.02)';
            draggedItem.style.zIndex = '10001';
            draggedItem.style.boxShadow = '0 6px 16px rgba(0,0,0,0.15)';
            draggedItem.style.background = '#f0f7ff';
            draggedItem.style.borderRadius = '4px';
            draggedItem.style.margin = '5px 0';
            draggedItem.style.position = 'relative';
            draggedItem.style.width = `${originalRect.width}px`;
            
            // 创建占位符
            const placeholder = document.createElement('div');
            placeholder.className = 'drag-placeholder';
            placeholder.style.height = `${originalRect.height}px`;
            placeholder.style.opacity = '0.3';
            placeholder.style.backgroundColor = '#e9ecef';
            placeholder.style.borderRadius = '4px';
            placeholder.style.margin = '5px 0';
            placeholder.style.transition = 'all 0.2s ease';
            itemDiv.parentNode.insertBefore(placeholder, itemDiv);
            itemDiv.placeholder = placeholder;
            
            // 隐藏原元素但保留占位空间
            setTimeout(() => {
                draggedItem.style.opacity = '0';
            }, 10);
        });
        
        // 拖动结束
        document.addEventListener('mouseup', () => {
            if (!isDragging ||!isEditMode ||!draggedItem) return;
            
            // 移除拖动状态类
            draggedItem.classList.remove('dragging');
            
            // 恢复元素样式
            draggedItem.style.opacity = '';
            draggedItem.style.transform = '';
            draggedItem.style.zIndex = '';
            draggedItem.style.boxShadow = '';
            draggedItem.style.background = '';
            draggedItem.style.borderRadius = '';
            draggedItem.style.margin = '';
            draggedItem.style.position = '';
            draggedItem.style.width = '';
            draggedItem.style.top = '';
            
            // 将拖动的元素移动到占位符位置
            if (draggedItem.placeholder && draggedItem.placeholder.parentNode) {
                draggedItem.placeholder.parentNode.insertBefore(draggedItem, draggedItem.placeholder);
                draggedItem.placeholder.parentNode.removeChild(draggedItem.placeholder);
            }
            
            // 重置拖动状态
            isDragging = false;
            draggedItem.placeholder = null;
            draggedItem = null;
            
            // 更新顺序
            updateItemOrder();
        });
        
        // 鼠标移动时处理拖动
        document.addEventListener('mousemove', (e) => {
            if (!isDragging ||!isEditMode ||!draggedItem) return;
            
            e.preventDefault();
            
            // 计算拖动元素的新位置
            const listRect = itemList.getBoundingClientRect();
            const newTop = e.clientY - listRect.top - initialOffsetY;
            
            // 限制拖动范围在列表内
            if (newTop > 0 && newTop < listRect.height - draggedItem.offsetHeight) {
                draggedItem.style.top = `${newTop}px`;
            }
            
            // 确定新位置
            const afterElement = getDragAfterElement(itemList, e.clientY);
            if (afterElement && afterElement!== draggedItem.placeholder) {
                itemList.insertBefore(draggedItem.placeholder, afterElement);
            } else if (!afterElement && draggedItem.placeholder.nextSibling) {
                itemList.appendChild(draggedItem.placeholder);
            }
        });
        
        // 辅助函数:确定拖动元素应该放置在哪个元素后面
        function getDragAfterElement(container, y) {
            const draggableElements = [...container.querySelectorAll('.tax-item:not(.dragging)')];
            
            return draggableElements.reduce((closest, child) => {
                const box = child.getBoundingClientRect();
                const offset = y - box.top - box.height / 2;
                
                if (offset < 0 && offset > closest.offset) {
                    return { offset: offset, element: child };
                } else {
                    return closest;
                }
            }, { offset: Number.NEGATIVE_INFINITY }).element;
        }
    }

    // 触发输入框事件
    function triggerInputEvents(input) {
        const inputEvent = new Event('input', { bubbles: true });
        const changeEvent = new Event('change', { bubbles: true });
        input.dispatchEvent(inputEvent);
        input.dispatchEvent(changeEvent);
    }

    // 清除选中状态
    function clearSelection() {
        const items = itemList.querySelectorAll('.tax-item');
        items.forEach(item => {
            if (item.dataset.content!== lastSelectedItem) {
                item.style.background = '#fff';
            }
        });
    }

    // 切换编辑模式
    function toggleEditMode() {
        isEditMode =!isEditMode;
        
        // 确保编辑按钮文本正确切换
        editToggleButton.textContent = isEditMode? '完成' : '编辑';
        
        // 使用类名选择器确保所有条目都被处理
        const items = document.querySelectorAll('.tax-item');
        
        // 遍历所有条目,确保每个条目的控制元素都正确显示/隐藏
        items.forEach((item, index) => {
            const dragContainer = item.querySelector('.drag-container');
            const editBtn = item.querySelector('.edit-btn');
            const deleteBtn = item.querySelector('.delete-btn');
            
            // 为显示/隐藏添加动画效果
            if (isEditMode) {
                // 错开时间显示,创造流畅的序列动画
                setTimeout(() => {
                    dragContainer.style.display = 'flex';
                    editBtn.style.display = 'inline-block';
                    deleteBtn.style.display = 'inline-block';
                    // 淡入效果
                    dragContainer.style.opacity = '0';
                    editBtn.style.opacity = '0';
                    deleteBtn.style.opacity = '0';
                    
                    setTimeout(() => {
                        dragContainer.style.opacity = '1';
                        editBtn.style.opacity = '1';
                        deleteBtn.style.opacity = '1';
                    }, 50);
                }, index * 50);
            } else {
                // 淡出效果
                dragContainer.style.opacity = '0';
                editBtn.style.opacity = '0';
                deleteBtn.style.opacity = '0';
                
                setTimeout(() => {
                    dragContainer.style.display = 'none';
                    editBtn.style.display = 'none';
                    deleteBtn.style.display = 'none';
                }, 200);
            }
            
            // 编辑模式下文本区域不可点击
            const textSpan = item.querySelector('span');
            textSpan.style.cursor = isEditMode? 'default' : 'pointer';
        });

        // 显示或隐藏导入导出按钮,添加淡入淡出效果
        if (isEditMode) {
            importButton.style.display = 'inline-block';
            exportButton.style.display = 'inline-block';
            importButton.style.opacity = '0';
            exportButton.style.opacity = '0';
            
            setTimeout(() => {
                importButton.style.opacity = '1';
                exportButton.style.opacity = '1';
            }, 100);
        } else {
            importButton.style.opacity = '0';
            exportButton.style.opacity = '0';
            
            setTimeout(() => {
                importButton.style.display = 'none';
                exportButton.style.display = 'none';
            }, 200);
        }
        
        // 显示或隐藏左侧调整手柄
        leftResizeHandle.style.display = isEditMode? 'block' : 'none';
    }

    // 编辑条目 - 修复编辑窗口不显示问题
    function editItem(itemDiv, oldContent, oldNote) {
        const modal = document.createElement('div');
        Object.assign(modal.style, {
            position: 'fixed',
            top: '50%',
            left: '50%',
            transform: 'translate(-50%, -50%)',
            background: '#fff',
            border: '1px solid #ccc',
            padding: '20px',
            borderRadius: '8px',
            boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
            zIndex: 10001,
            display: 'flex',
            flexDirection: 'column',
            gap: '10px',
            width: '300px',
            // 添加模态框显示动画
            opacity: '0',
            transform: 'translate(-50%, -50%) scale(0.95)',
            transition: 'opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
        });
        
        // 添加模态框背景遮罩
        const overlay = document.createElement('div');
        Object.assign(overlay.style, {
            position: 'fixed',
            top: '0',
            left: '0',
            right: '0',
            bottom: '0',
            background: 'rgba(0,0,0,0.5)',
            zIndex: 10000,
            opacity: '0',
            transition: 'opacity 0.3s ease'
        });
        document.body.appendChild(overlay);
        
        // 触发动画
        setTimeout(() => {
            modal.style.opacity = '1';
            modal.style.transform = 'translate(-50%, -50%) scale(1)';
            overlay.style.opacity = '0.5';
        }, 10);

        const taxNumberInput = document.createElement('input');
        taxNumberInput.value = oldContent;
        taxNumberInput.style.padding = '8px';
        taxNumberInput.style.border = '1px solid #ccc';
        taxNumberInput.style.borderRadius = '3px';
        taxNumberInput.style.transition = 'border-color 0.2s ease';
        taxNumberInput.addEventListener('focus', () => {
            taxNumberInput.style.borderColor = '#007BFF';
            taxNumberInput.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        taxNumberInput.addEventListener('blur', () => {
            taxNumberInput.style.borderColor = '#ccc';
            taxNumberInput.style.boxShadow = 'none';
        });
        modal.appendChild(taxNumberInput);

        const noteInput = document.createElement('input');
        noteInput.value = oldNote;
        noteInput.style.padding = '8px';
        noteInput.style.border = '1px solid #ccc';
        noteInput.style.borderRadius = '3px';
        noteInput.style.transition = 'border-color 0.2s ease';
        noteInput.addEventListener('focus', () => {
            noteInput.style.borderColor = '#007BFF';
            noteInput.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        noteInput.addEventListener('blur', () => {
            noteInput.style.borderColor = '#ccc';
            noteInput.style.boxShadow = 'none';
        });
        modal.appendChild(noteInput);

        const confirmButton = createButton('确认', () => {
            const newContent = taxNumberInput.value.trim();
            const newNote = noteInput.value.trim();
            if (!newContent ||!newNote) {
                alert('税号和备注都不能为空,请重新输入。');
                return;
            }

            // 编辑后的过渡动画
            itemDiv.style.opacity = '0.5';
            setTimeout(() => {
                const textSpan = itemDiv.querySelector('span');
                textSpan.textContent = newNote;
                itemDiv.dataset.content = newContent;

                const items = GM_getValue('autoFillItems', []);
                const index = items.findIndex(item => item.content === oldContent);
                if (index!== -1) {
                    items[index] = { content: newContent, note: newNote };
                    GM_setValue('autoFillItems', items);
                }
                
                // 恢复不透明度
                itemDiv.style.opacity = '1';
                
                // 关闭动画
                modal.style.opacity = '0';
                modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
                overlay.style.opacity = '0';
                setTimeout(() => {
                    document.body.removeChild(modal);
                    document.body.removeChild(overlay);
                }, 300);
            }, 200);
        });
        modal.appendChild(confirmButton);

        const cancelButton = createButton('取消', () => {
            // 关闭动画
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        }, true);
        modal.appendChild(cancelButton);

        // 点击遮罩关闭模态框
        overlay.addEventListener('click', () => {
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        });

        // 修复编辑窗口不显示问题:明确添加到文档
        document.body.appendChild(modal);
        return modal;
    }

    // 删除条目
    function deleteItem(itemDiv, content) {
        // 删除前的淡出动画
        itemDiv.style.opacity = '0';
        itemDiv.style.transform = 'translateY(10px)';
        itemDiv.style.height = itemDiv.offsetHeight + 'px';
        itemDiv.style.overflow = 'hidden';
        itemDiv.style.margin = '0';
        
        setTimeout(() => {
            const items = GM_getValue('autoFillItems', []);
            const newItems = items.filter(item => item.content!== content);
            GM_setValue('autoFillItems', newItems);
            itemList.removeChild(itemDiv);
            if (content === lastSelectedItem) {
                lastSelectedItem = null;
                GM_setValue('lastSelectedItem', null);
            }
        }, 300);
    }

    // 更新条目顺序
    function updateItemOrder() {
        const items = Array.from(document.querySelectorAll('.tax-item'));
        const newItemOrder = items.map(item => {
            const note = item.querySelector('span').textContent;
            const content = item.dataset.content;
            return { content, note };
        });
        GM_setValue('autoFillItems', newItemOrder);
    }

    // 导入数据
    function importData() {
        const importModal = document.createElement('div');
        Object.assign(importModal.style, {
            position: 'fixed',
            top: '50%',
            left: '50%',
            transform: 'translate(-50%, -50%)',
            background: '#fff',
            border: '1px solid #ccc',
            padding: '20px',
            borderRadius: '8px',
            boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
            zIndex: 10001,
            display: 'flex',
            flexDirection: 'column',
            gap: '10px',
            width: '350px',
            // 添加模态框显示动画
            opacity: '0',
            transform: 'translate(-50%, -50%) scale(0.95)',
            transition: 'opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
        });
        
        // 添加模态框背景遮罩
        const overlay = document.createElement('div');
        Object.assign(overlay.style, {
            position: 'fixed',
            top: '0',
            left: '0',
            right: '0',
            bottom: '0',
            background: 'rgba(0,0,0,0.5)',
            zIndex: 10000,
            opacity: '0',
            transition: 'opacity 0.3s ease'
        });
        document.body.appendChild(overlay);
        
        // 触发动画
        setTimeout(() => {
            importModal.style.opacity = '1';
            importModal.style.transform = 'translate(-50%, -50%) scale(1)';
            overlay.style.opacity = '0.5';
        }, 10);

        const dataTextarea = document.createElement('textarea');
        dataTextarea.placeholder = '请输入要导入的数据(格式:税号,备注;税号,备注;...)';
        dataTextarea.style.padding = '8px';
        dataTextarea.style.border = '1px solid #ccc';
        dataTextarea.style.borderRadius = '3px';
        dataTextarea.style.height = '150px';
        dataTextarea.style.transition = 'border-color 0.2s ease';
        dataTextarea.addEventListener('focus', () => {
            dataTextarea.style.borderColor = '#007BFF';
            dataTextarea.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        dataTextarea.addEventListener('blur', () => {
            dataTextarea.style.borderColor = '#ccc';
            dataTextarea.style.boxShadow = 'none';
        });
        importModal.appendChild(dataTextarea);

        const confirmButton = createButton('确认导入', () => {
            const dataStr = dataTextarea.value.trim();
            if (!dataStr) {
                alert('导入数据不能为空,请重新输入。');
                return;
            }
            try {
                const lines = dataStr.split(';');
                const importedItems = [];
                for (const line of lines) {
                    const [content, note] = line.split(',');
                    if (content && note) {
                        importedItems.push({ content: content.trim(), note: note.trim() });
                    } else {
                        throw new Error('导入数据格式错误,请检查。');
                    }
                }
                
                // 清空现有条目时的动画
                const existingItems = document.querySelectorAll('.tax-item');
                existingItems.forEach((item, index) => {
                    setTimeout(() => {
                        item.style.opacity = '0';
                        item.style.transform = 'translateY(10px)';
                        
                        if (index === existingItems.length - 1) {
                            setTimeout(() => {
                                itemList.innerHTML = '';
                                GM_setValue('autoFillItems', importedItems);
                                importedItems.forEach((item, i) => {
                                    // 错开时间添加新条目,创造流畅动画
                                    setTimeout(() => {
                                        addItemToWindow(item.content, item.note, itemList);
                                    }, i * 80);
                                });
                                alert('数据导入成功!');
                                
                                // 关闭动画
                                importModal.style.opacity = '0';
                                importModal.style.transform = 'translate(-50%, -50%) scale(0.95)';
                                overlay.style.opacity = '0';
                                setTimeout(() => {
                                    document.body.removeChild(importModal);
                                    document.body.removeChild(overlay);
                                }, 300);
                            }, 300);
                        }
                    }, index * 50);
                });
            } catch (error) {
                alert(`数据导入失败:${error.message}`);
            }
        });
        importModal.appendChild(confirmButton);

        const cancelButton = createButton('取消', () => {
            // 关闭动画
            importModal.style.opacity = '0';
            importModal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(importModal);
                document.body.removeChild(overlay);
            }, 300);
        }, true);
        importModal.appendChild(cancelButton);

        // 点击遮罩关闭模态框
        overlay.addEventListener('click', () => {
            importModal.style.opacity = '0';
            importModal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(importModal);
                document.body.removeChild(overlay);
            }, 300);
        });

        document.body.appendChild(importModal);
    }

    // 导出数据
    function exportData() {
        const items = GM_getValue('autoFillItems', []);
        const dataStr = items.map(item => `${item.content},${item.note}`).join(';\n');
        const exportModal = document.createElement('div');
        Object.assign(exportModal.style, {
            position: 'fixed',
            top: '50%',
            left: '50%',
            transform: 'translate(-50%, -50%)',
            background: '#fff',
            border: '1px solid #ccc',
            padding: '20px',
            borderRadius: '8px',
            boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
            zIndex: 10001,
            display: 'flex',
            flexDirection: 'column',
            gap: '10px',
            width: '350px',
            // 添加模态框显示动画
            opacity: '0',
            transform: 'translate(-50%, -50%) scale(0.95)',
            transition: 'opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
        });
        
        // 添加模态框背景遮罩
        const overlay = document.createElement('div');
        Object.assign(overlay.style, {
            position: 'fixed',
            top: '0',
            left: '0',
            right: '0',
            bottom: '0',
            background: 'rgba(0,0,0,0.5)',
            zIndex: 10000,
            opacity: '0',
            transition: 'opacity 0.3s ease'
        });
        document.body.appendChild(overlay);
        
        // 触发动画
        setTimeout(() => {
            exportModal.style.opacity = '1';
            exportModal.style.transform = 'translate(-50%, -50%) scale(1)';
            overlay.style.opacity = '0.5';
        }, 10);

        const dataTextarea = document.createElement('textarea');
        dataTextarea.value = dataStr;
        dataTextarea.readOnly = true;
        dataTextarea.style.padding = '8px';
        dataTextarea.style.border = '1px solid #ccc';
        dataTextarea.style.borderRadius = '3px';
        dataTextarea.style.height = '150px';
        exportModal.appendChild(dataTextarea);

        const copyButton = createButton('复制数据', () => {
            dataTextarea.select();
            document.execCommand('copy');
            
            // 复制成功的反馈动画
            copyButton.textContent = '已复制!';
            copyButton.style.background = '#28a745';
            setTimeout(() => {
                copyButton.textContent = '复制数据';
                copyButton.style.background = '#007BFF';
            }, 1500);
        });
        exportModal.appendChild(copyButton);

        const closeButton = createButton('关闭', () => {
            // 关闭动画
            exportModal.style.opacity = '0';
            exportModal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(exportModal);
                document.body.removeChild(overlay);
            }, 300);
        }, true);
        exportModal.appendChild(closeButton);

        // 点击遮罩关闭模态框
        overlay.addEventListener('click', () => {
            exportModal.style.opacity = '0';
            exportModal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(exportModal);
                document.body.removeChild(overlay);
            }, 300);
        });

        document.body.appendChild(exportModal);
    }

    // 切换账号自动填写
    function toggleAccountAutoFill() {
        // 添加切换按钮的动画效果
        accountAutoFillSwitch.style.transform = 'scale(0.9)';
        accountAutoFillSwitch.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
        setTimeout(() => {
            accountAutoFillSwitch.style.transform = 'scale(1)';
            accountAutoFillSwitch.style.boxShadow = 'none';
        }, 150);
        
        isAutoFillAccount =!isAutoFillAccount;
        accountAutoFillSwitch.textContent = isAutoFillAccount? '自动填账号密码: 开' : '自动填账号密码: 关';
        GM_setValue('isAutoFillAccount', isAutoFillAccount);

        if (isAutoFillAccount) {
            if (!accountInfo) {
                const modal = createAccountInfoModal();
                document.body.appendChild(modal);
            } else {
                setTimeout(() => {
                    const accountInput = findInputInIframes('input[placeholder="居民身份证号码/手机号码/用户名"]');
                    const passwordInput = findInputInIframes('input[placeholder="个人用户密码"]');
                    if (accountInput) {
                        accountInput.value = accountInfo.account;
                        triggerInputEvents(accountInput);
                    }
                    if (passwordInput) {
                        passwordInput.value = accountInfo.password;
                        triggerInputEvents(passwordInput);
                    }
                }, 500);
            }
        } else {
            accountInfo = null;
            GM_setValue('accountInfo', null);
            const accountInput = findInputInIframes('input[placeholder="居民身份证号码/手机号码/用户名"]');
            const passwordInput = findInputInIframes('input[placeholder="个人用户密码"]');
            if (accountInput) {
                accountInput.value = '';
                triggerInputEvents(accountInput);
            }
            if (passwordInput) {
                passwordInput.value = '';
                triggerInputEvents(passwordInput);
            }
        }
    }

    // 创建账号信息模态框
    function createAccountInfoModal() {
        const modal = document.createElement('div');
        Object.assign(modal.style, {
            position: 'fixed',
            top: '50%',
            left: '50%',
            transform: 'translate(-50%, -50%)',
            background: '#fff',
            border: '1px solid #ccc',
            padding: '20px',
            borderRadius: '8px',
            boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
            zIndex: 10001,
            display: 'flex',
            flexDirection: 'column',
            gap: '10px',
            width: '300px',
            // 添加模态框显示动画
            opacity: '0',
            transform: 'translate(-50%, -50%) scale(0.95)',
            transition: 'opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
        });
        
        // 添加模态框背景遮罩
        const overlay = document.createElement('div');
        Object.assign(overlay.style, {
            position: 'fixed',
            top: '0',
            left: '0',
            right: '0',
            bottom: '0',
            background: 'rgba(0,0,0,0.5)',
            zIndex: 10000,
            opacity: '0',
            transition: 'opacity 0.3s ease'
        });
        document.body.appendChild(overlay);
        
        // 触发动画
        setTimeout(() => {
            modal.style.opacity = '1';
            modal.style.transform = 'translate(-50%, -50%) scale(1)';
            overlay.style.opacity = '0.5';
        }, 10);

        const accountInput = document.createElement('input');
        accountInput.placeholder = '请输入账号';
        accountInput.style.padding = '8px';
        accountInput.style.border = '1px solid #ccc';
        accountInput.style.borderRadius = '3px';
        accountInput.style.transition = 'border-color 0.2s ease';
        accountInput.addEventListener('focus', () => {
            accountInput.style.borderColor = '#007BFF';
            accountInput.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        accountInput.addEventListener('blur', () => {
            accountInput.style.borderColor = '#ccc';
            accountInput.style.boxShadow = 'none';
        });
        modal.appendChild(accountInput);

        const passwordInput = document.createElement('input');
        passwordInput.type = 'password';
        passwordInput.placeholder = '请输入密码';
        passwordInput.style.padding = '8px';
        passwordInput.style.border = '1px solid #ccc';
        passwordInput.style.borderRadius = '3px';
        passwordInput.style.transition = 'border-color 0.2s ease';
        passwordInput.addEventListener('focus', () => {
            passwordInput.style.borderColor = '#007BFF';
            passwordInput.style.boxShadow = '0 0 0 2px rgba(0, 123, 255, 0.25)';
        });
        passwordInput.addEventListener('blur', () => {
            passwordInput.style.borderColor = '#ccc';
            passwordInput.style.boxShadow = 'none';
        });
        modal.appendChild(passwordInput);

        const confirmButton = createButton('确认', () => {
            const account = accountInput.value.trim();
            const password = passwordInput.value.trim();
            if (!account ||!password) {
                alert('账号和密码都不能为空,请重新输入。');
                return;
            }
            accountInfo = { account, password };
            GM_setValue('accountInfo', accountInfo);
            setTimeout(() => {
                const accountInputOnPage = findInputInIframes('input[placeholder="居民身份证号码/手机号码/用户名"]');
                const passwordInputOnPage = findInputInIframes('input[placeholder="个人用户密码"]');
                if (accountInputOnPage) {
                    accountInputOnPage.value = account;
                    triggerInputEvents(accountInputOnPage);
                }
                if (passwordInputOnPage) {
                    passwordInputOnPage.value = password;
                    triggerInputEvents(passwordInputOnPage);
                }
            }, 500);
            
            // 关闭动画
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        });
        modal.appendChild(confirmButton);

        const cancelButton = createButton('取消', () => {
            isAutoFillAccount = false;
            accountAutoFillSwitch.textContent = '自动填账号密码: 关';
            GM_setValue('isAutoFillAccount', isAutoFillAccount);
            
            // 关闭动画
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        }, true);
        modal.appendChild(cancelButton);

        // 点击遮罩关闭模态框
        overlay.addEventListener('click', () => {
            modal.style.opacity = '0';
            modal.style.transform = 'translate(-50%, -50%) scale(0.95)';
            overlay.style.opacity = '0';
            setTimeout(() => {
                document.body.removeChild(modal);
                document.body.removeChild(overlay);
            }, 300);
        });

        return modal;
    }

    // 自动填充账号密码(如果开启)
    if (isAutoFillAccount && accountInfo) {
        setTimeout(() => {
            const accountInput = findInputInIframes('input[placeholder="居民身份证号码/手机号码/用户名"]');
            const passwordInput = findInputInIframes('input[placeholder="个人用户密码"]');
            if (accountInput) {
                accountInput.value = accountInfo.account;
                triggerInputEvents(accountInput);
            }
            if (passwordInput) {
                passwordInput.value = accountInfo.password;
                triggerInputEvents(passwordInput);
            }
        }, 500);
    }

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址