// ==UserScript==
// @name         青禾院-2.7版:脚本全能助手兼容学习、AI课、考试、支持免费视频刷 | 超星学习通 | 智慧树 | U校园 | MOOC | 继续教育类 | 优课学堂 | 考试 | 青书学堂 | 优学院 | 超星学习通 | AI解答 | 学习通 | 学习强国 | 中国大学mooc | 智慧职教 | 青书学堂 | 知到 | 乐跑 | 世界运动 | 阳光跑 | 等等课程提供学习【青禾院2.7 轻量版】
// @namespace    qinghy
// @version      2.8
// @description  当前系统脚本有几种模式已完美兼容【学习通、智慧树、签到等课程】;【完美匹配应付考试、测试、搜题】;【是个崭新的平台,基于生成AI-ChatGpt生成答案】;【自动提交、自动收录答案、无需打开电脑运行脚本】;新手建议不使用js脚本进行操作,因操作过程麻烦上手难度不小、也不大,但是耗时间研究,也有可能研究出来还是收费的;可咨询群:1042758197
// @author       青禾院-2.7版本
// @grant        none
// @run-at       document-end
// @license      MIT
// @icon         https://qinghy.top/upload/images/qinglyc.jpg
// @match        *://*.chaoxing.com/*
// @match        *://*.edu.cn/*
// @match        *://*.nbdlib.cn/*
// @match        *://*.hnsyu.net/*
// @match        *://*.gdhkmooc.com/*
// @match        *://*.zhihuishu.com/*
// @match        *://*.taobao.com/*
// @match        *://*.tmall.com/*
// @match        *://chaoshi.detail.tmall.com/*
// @match        *://*.tmall.hk/*
// @match        *://*.liangxinyao.com/*
// @match        *://*.jd.com/*
// @match        *://*.jd.hk/*
// @match      	 *://*.jkcsjd.com/*
// @match        *://*.yiyaojd.com/*
// @match        *://*.vip.com/*
// @match        *://*.vipglobal.hk/*
// @exclude      *://login.taobao.com/*
// @exclude      *://login.tmall.com/*
// @exclude      *://uland.taobao.com/*
// @exclude      *://pages.tmall.com/*
// @exclude      *://wq.jd.com/*
// @connect      mooc1-1.chaoxing.com
// @connect      mooc1.chaoxing.com
// @connect      mooc1-2.chaoxing.com
// @connect      passport2-api.chaoxing.com
// @connect      www.tiku.me
// @connect	     cx.icodef.com
// @connect      cx.icodef.com
// @connect      q.icodef.com
// @connect      azkou.cn
// @connect    	 localhost
// @connect    	 127.0.0.1
// @grant        GM_getResourceText
// @grant        GM_getValue
// @grant        GM_info
// @grant        GM_setValue
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// @grant      	 GM_getTab
// @grant      	 GM_saveTab
// @grant      	 GM_listValues
// @grant      	 GM_deleteValue
// @grant      	 GM_notification
// @grant      	 GM_addValueChangeListener
// @grant      	 GM_removeValueChangeListener
// @run-at       document-start
// @antifeature  ads
// @namespace    https://qinghy.top
// @homepage     https://scriptcat.org/zh-CN/script-show-page/3038
// @source       https://qinghy.top
// @antifeature  payment  可使用web付费脚本平台进行播放、考试、题库
// ==/UserScript==

(function() {
    'use strict';

    // 创建悬浮窗口
    const floatingWindow = document.createElement('div');
    floatingWindow.id = 'baidu-floating-window';
    floatingWindow.style.cssText = `
        position: fixed;
        z-index: 9999;
        background-color: #ffffff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        width: 300px;
        height: 500px;
        left: 20px;
        top: 20px;
        font-family: 'Microsoft YaHei', sans-serif;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    `;

    // 
    const titleBar = document.createElement('div');
    titleBar.style.cssText = `
        padding: 12px 15px;
        background-color: #f5f5f5;
        border-bottom: 1px solid #e0e0e0;
        cursor: move;
        display: flex;
        justify-content: space-between;
        align-items: center;
        user-select: none;
        flex-shrink: 0;
    `;

    const title = document.createElement('h3');
    title.textContent = '青禾院-轻量版V 2.0';
    title.style.cssText = `
        margin: 0;
        font-size: 15px;
        color: #333;
        font-weight: normal;
    `;

    const closeBtn = document.createElement('span');
    closeBtn.textContent = '×';
    closeBtn.style.cssText = `
        font-size: 20px;
        cursor: pointer;
        color: #999;
        line-height: 1;
        padding: 0 5px;
    `;

    // 
    const navBar = document.createElement('div');
    navBar.style.cssText = `
        display: flex;
        border-bottom: 1px solid #f0f0f0;
        background-color: #fafafa;
        flex-shrink: 0;
    `;


    // 
    const createNavButton = (text, onClick) => {
        const btn = document.createElement('button');
        btn.textContent = text;
        btn.style.cssText = `
            flex: 1;
            padding: 12px 0;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 14px;
            color: #666;
            transition: all 0.3s;
            position: relative;
        `;
        btn.addEventListener('click', onClick);
        return btn;
    };

    const homeBtn = createNavButton('首页', () => {
        homeContent.style.display = 'block';
        settingsContent.style.display = 'none';
        questionBankContent.style.display = 'none';
        myContent.style.display = 'none';
        description.style.display = 'block';
        playButton.style.display = 'none';
    });

    const settingsBtn = createNavButton('设置', () => {
        homeContent.style.display = 'none';
        settingsContent.style.display = 'block';
        questionBankContent.style.display = 'none';
        myContent.style.display = 'none';
        description.style.display = 'block';
        playButton.style.display = 'none';
    });

    const questionBankBtn = createNavButton('题库', () => {
        homeContent.style.display = 'none';
        settingsContent.style.display = 'none';
        questionBankContent.style.display = 'block';
        myContent.style.display = 'none';
        description.style.display = 'block';
        playButton.style.display = 'block';
    });

    // 
    const availableCourses = [
        "学习通",
        "智慧树",
        "U校园",
        "MOOC",
        "学习强国",
        "知到",
        "乐跑",
        "优学院"
    ];

    const myBtn = createNavButton('我的', () => {
        homeContent.style.display = 'none';
        settingsContent.style.display = 'none';
        questionBankContent.style.display = 'none';
        myContent.style.display = 'block';
        description.style.display = 'none';
        playButton.style.display = 'none';
    });

    // 
    const content = document.createElement('div');
    content.style.cssText = `
        padding: 15px;
        overflow-y: auto;
        flex-grow: 1;
    `;

    // 
    const homeContent = document.createElement('div');
    
    homeContent.innerHTML = `
        <h4 style="margin-top: 0;"></h4>
        <p style="font-size: 15px;"><strong>首页</strong></p>
        <br>
        <p style="color: #666; line-height: 1.6;">青禾院学习助手2.0版本</p>
        <p style="font-size: 15px;">如果!如果!如果!2.0版本无法使用请移步至3.0版本,以下连接快速安装3.0版本</p><br>
        <p style="font-size: 15px;"><a href="https://scriptcat.org/zh-CN/script-show-page/3249/">下载新版本3.0版本</a>:</p>
    `;

    // 
    const settingsContent = document.createElement('div');
    settingsContent.innerHTML = `
        <h4 style="margin-top: 0;">设置</h4>
        
        <div style="margin-bottom: 15px;">
            <label for="auto-answer-toggle" style="display: inline-block; margin-right: 10px;">自动答题:</label>
            <label class="switch">
                <input type="checkbox" id="auto-answer-toggle">
                <span class="slider"></span>
            </label>
            <p id="auto-answer-status" style="color: #666; line-height: 1.6; margin-top: 5px;">(当前状态:已关闭)</p>
        </div>
        
        <div style="margin-bottom: 15px;">
            <label for="need-answer-toggle" style="display: inline-block; margin-right: 10px;">是否需要答题:</label>
            <label class="switch">
                <input type="checkbox" id="need-answer-toggle">
                <span class="slider"></span>
            </label>
<!--            <p id="need-answer-status" style="color: #666; line-height: 1.6; margin-top: 5px;">(当前状态:已关闭)</p>-->
        </div>
        
        <label for="speed-select">选择播放倍速:</label>
        <select id="speed-select">
            <option value="1">1倍</option>
            <option value="1.5">1.5倍</option>
            <option value="2">2倍</option>
            <option value="2.5">2.5倍</option>
            <option value="3">3倍</option>
            <option value="8">8倍</option>
        </select>
        <br><br>
        
        <label for="chapter-toggle" style="display: inline-block; margin-right: 10px;">章节是否开启:</label>
        <label class="switch">
            <input type="checkbox" id="chapter-toggle">
            <span class="slider"></span>
        </label>
        <p id="chapter-status" style="color: #666; line-height: 1.6; margin-top: 5px;">(当前状态:已关闭)</p>
        
        <div style="margin-top: 15px;">
            <label>设置题库正确率:</label>
            <div style="display: flex; align-items: center; margin-top: 5px;">
                <div id="accuracy-bar" style="flex-grow: 1; height: 20px; background-color: #f0f0f0; border-radius: 10px; overflow: hidden;">
                    <div id="accuracy-progress" style="height: 100%; width: 87%; background-color: #52c41a; border-radius: 10px; transition: width 0.3s;"></div>
                </div>
                <span id="accuracy-value" style="margin-left: 10px; color: #666;">87%</span>
            </div>
            <div style="margin-top: 10px; display: flex; justify-content: space-between;">
                <button id="decrease-accuracy" style="padding: 5px 10px; background-color: #ff4d4f; color: white; border: none; border-radius: 4px; cursor: pointer;">-5%</button>
                <button id="increase-accuracy" style="padding: 5px 10px; background-color: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer;">+5%</button>
            </div>
        </div>
        
        <div id="submit-section" style="margin-top: 20px;">
            <button id="settings-submit-btn" style="width: 100%; padding: 10px; background-color: #52c41a; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.3s;">提交设置</button>
            <div id="submit-message" style="margin-top: 10px; text-align: center; color: #52c41a; display: none;">
                <svg style="width: 16px; height: 16px; vertical-align: middle; margin-right: 5px;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" fill="currentColor"/>
                </svg>
                <span>已提交成功!</span>
            </div>
        </div>
    `;

    // 
    const questionBankContent = document.createElement('div');
    questionBankContent.innerHTML = `
        <h4 style="margin-top: 0;">题库【基本信息】</h4>
         
        <div style="margin-bottom: 15px;">
            <label for="course-search" style="display: block; margin-bottom: 5px; color: #666;">请输入课程名称:</label>
            <div style="display: flex;">
                <input type="text" id="course-search" 
                       style="flex: 1;
                              padding: 8px 12px; 
                              border: 1px solid #d9d9d9;
                              border-right: none;
                              border-radius: 4px 0 0 4px; 
                              box-sizing: border-box;
                              transition: all 0.3s;"
                       placeholder="例如:学习通、智慧树、青书学堂">
                <button id="search-course-btn" 
                        style="padding: 0 15px;
                               background-color: #1890ff;
                               color: white;
                               border: none;
                               border-radius: 0;
                               cursor: pointer;
                               transition: all 0.3s;">
                    搜索
                </button>
                <button id="reset-search-btn"
                        style="padding: 0 15px;
                               background-color: #d9d9d9;
                               color: #666;
                               border: none;
                               border-radius: 0 4px 4px 0;
                               cursor: pointer;
                               transition: all 0.3s;">
                    重置
                </button>
            </div>
            <p id="search-status" style="color: #666; font-size: 13px; margin-top: 5px;"></p>
        </div>
        
        <!-- 保留其他内容... -->
        
        <div id="search-results" style="margin-top: 20px; display: none;">
            <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
                <h5 style="margin: 0;">搜索结果</h5>
                <button id="close-results-btn" 
                        style="background: none; border: none; color: #666; cursor: pointer; font-size: 12px;">
                    <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#666">
                        <line x1="18" y1="6" x2="6" y2="18"></line>
                        <line x1="6" y1="6" x2="18" y2="18"></line>
                    </svg>
                </button>
            </div>
            <div id="results-container" style="border: 1px solid #f0f0f0; border-radius: 4px; padding: 10px;">
                
            </div>
        </div>
         <!-- 反馈问题 -->
          <div style="margin-bottom: 15px;">
            <label for="name-input" style="display: block; margin-bottom: 5px; color: #666;">反馈问题:</label>
            <input type="text" id="name-input" 
                   style="width: 100%; 
                          padding: 8px 12px; 
                          border: 1px solid #d9d9d9; 
                          border-radius: 4px; 
                          box-sizing: border-box;
                          transition: all 0.3s;"
                   placeholder="反馈问题吧!反正我看不到!嘻嘻嘻">
            <p id="name-status" style="color: #666; font-size: 13px; margin-top: 5px;"></p>
        </div>
        
        
        <div style="margin: 20px 0; text-align: center;">
            <button id="buy-question-bank-btn" 
                    style="padding: 10px 20px;
                           background-color: #f5222d;
                           color: white;
                           border: none;
                           border-radius: 4px;
                           cursor: pointer;
                           font-weight: bold;
                           transition: all 0.3s;">
                <span style="display: inline-flex; align-items: center;">
                    <svg style="margin-right: 8px;" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                        <path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path>
                        <line x1="3" y1="6" x2="21" y2="6"></line>
                        <path d="M16 10a4 4 0 0 1-8 0"></path>
                    </svg>
                    脚本批量播放
                </span>
            </button>
            <p id="buy-status" style="color: #666; font-size: 13px; margin-top: 8px;"></p>
            <p style="color: #999; font-size: 12px; margin-top: 5px;">点击跳转到Tsing Wo College脚本批量播放</p>
        </div>
         
        <div style="margin-top: 20px;">
            <button id="question-bank-submit-btn" 
                    style="width: 100%; 
                           padding: 10px; 
                           background-color: #1890ff; 
                           color: white; 
                           border: none; 
                           border-radius: 4px; 
                           cursor: pointer;
                           transition: background-color 0.3s;">
                提交题库信息
            </button>
            <div id="question-bank-submit-message" 
                 style="margin-top: 10px; 
                        text-align: center; 
                        color: #52c41a; 
                        display: none;">
                <svg style="width: 16px; height: 16px; vertical-align: middle; margin-right: 5px;" 
                     viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" fill="currentColor"/>
                </svg>
                <span>提交成功!</span>
            </div>
        </div>
        <br>
        <p style="color: #666; line-height: 1.6;">-------------------公告-------------------</p>
    `;

    // 
    const myContent = document.createElement('div');
    myContent.style.display = 'none';
    myContent.innerHTML = `
<!--        <h4 style="margin-top: 0;">我的</h4>-->
<!--        <p style="color: #666; line-height: 1.6;">这里是你的个人内容区域。</p>-->
<!--        <p style="color: #666; line-height: 1.6;">你可以在这里添加任何你想展示的内容。</p>-->
        <ul style="color: #666; line-height: 1.6;">
            <!-- 个人资料查看区域 -->
        <div id="profile-section" style="margin-bottom: 20px;">
            <h5 style="margin-bottom: 15px; color: #333; border-bottom: 1px solid #f0f0f0; padding-bottom: 8px;">自检环境</h5>
            
            <div style="display: flex; align-items: center; margin-bottom: 12px;">
                <span style="width: 80px; color: #666;">读取浏览器IP:</span>
                <span id="profile-name" style="font-weight: 500; color: #ff0000;">失败</span>
            </div>
            
            <div style="display: flex; align-items: center; margin-bottom: 12px;">
                <span style="width: 80px; color: #666;">读取课程信息:</span>
                <span id="profile-gender" style="font-weight: 500; color: #ff0000;">失败</span>
            </div>
            
            <div style="display: flex; align-items: center; margin-bottom: 12px;">
                <span style="width: 80px; color: #666;">当前网络状态:</span>
                <span id="profile-address" style="font-weight: 500; color: #00ff00;">正常</span>
            </div>
            
            <div style="display: flex; align-items: center; margin-bottom: 12px;">
                <span style="width: 80px; color: #666;">检测刷课状态:</span>
                <span id="profile-status" style="font-weight: 500; color: #52c41a;">
                    <svg style="width: 14px; height: 14px; vertical-align: middle; margin-right: 5px;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" fill="currentColor"/>
                    </svg>
                    失败、未找到适配
                </span>
            </div>
            
            <button id="refresh-profile-btn" style="margin-top: 15px; padding: 6px 12px; background-color: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 13px;">
                <svg style="width: 14px; height: 14px; vertical-align: middle; margin-right: 5px;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M17.65 6.35A7.958 7.958 0 0012 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0112 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" fill="currentColor"/>
                </svg>
                刷新重新配置
            </button>
        </div>
        
        <div style="margin-top: 20px;">
            <h5 style="margin-bottom: 15px; color: #200; border-bottom: 1px solid #ff0000; padding-bottom: 8px;"></h5>
            <button id="view-progress-btn" 
                    style="width: 150px; 
                           padding: 10px; 
                           background-color: #722ed1; 
                           color: white; 
                           border: none; 
                           border-radius: 4px; 
                           cursor: pointer;
                           margin-bottom: 15px;">
                查看课程进度
            </button>
                <a href="https://scriptcat.org/zh-CN/script-show-page/3249"
                    style="text-decoration: none;
                        display: inline-block;
                        width: 150px; 
                        padding: 10px; 
                        background-color:  #ff0000; 
                        color: white; 
                        border: none; 
                        border-radius: 4px; 
                        cursor: pointer;
                        margin-bottom: 15px;">
                        青禾院3.0版本【无视环境】安装直接使用
                </a>
            <div id="progress-info" style="display: none; border: 1px solid #f0f0f0; border-radius: 4px; padding: 15px;">
                <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
                    <span style="color: #666;">当前课程:</span>
                    <span id="progress-name" style="font-weight: 500;">读取不到课程,请确认课程</span>
                </div>
                <div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
                    <span style="color: #666;">当前进度:</span>
                    <!-- <span id="progress-age" style="font-weight: 500;">0%</span>-->
                    <div class="progress-container">
                      <span id="progress-age" class="progress-text">1%</span>
                      <div class="progress-bar" style="width: 1%;"></div>
                       <style>
                        .progress-container {
                          width: 150px;
                          height: 24px;
                          background: #f0f0f0;
                          border-radius: 12px;
                          position: relative;
                          overflow: hidden;
                        }
                        
                        .progress-bar {
                          height: 100%;
                          background: linear-gradient(90deg, #ff7e5f, #feb47b);
                          border-radius: 12px;
                          transition: width 0.5s ease;
                        }
                        
                        .progress-text {
                          position: absolute;
                          top: 50%;
                          left: 50%;
                          transform: translate(-50%, -50%);
                          font-weight: 500;
                          color: #333;
                          z-index: 2;
                        }
                        </style>
                    </div>
                </div>
                <div style="display: flex; justify-content: space-between;">
                    <span style="color: #666;">时间:</span>
                    <span id="progress-time" style="font-weight: 500;">${new Date().toLocaleString()}</span>
                </div>
            </div>
        </div>
        
       
        <div style="margin-top: 20px;">
            <h5 style="margin-bottom: 15px; color: #333; border-bottom: 1px solid #f0f0f0; padding-bottom: 8px;">其他功能</h5>
            <ul style="color: #666; line-height: 1.6; padding-left: 20px;">
                <li>开发中...</li>
                <li>开发中...</li>
                <li>敬请期待...</li>
            </ul>
        </div>
            <li>版本V 2.0  联系方式Q群:1042758197</li>
            <li></li>
        </ul>
    `;
        // 
    myContent.querySelector('#refresh-profile-btn').addEventListener('click', function() {
        // 
        this.innerHTML = `
            <svg style="width: 14px; height: 14px; vertical-align: middle; margin-right: 5px; animation: spin 1s linear infinite;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M17.65 6.35A7.958 7.958 0 0012 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0112 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" fill="currentColor"/>
            </svg>
            刷新中...
        `;

        // 
        setTimeout(() => {
            // 
            // 

            // 
            this.innerHTML = `
                <svg style="width: 14px; height: 14px; vertical-align: middle; margin-right: 5px;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M17.65 6.35A7.958 7.958 0 0012 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0112 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" fill="currentColor"/>
                </svg>
                刷新资料
            `;

            // 
            const statusElement = myContent.querySelector('#profile-status');
            statusElement.innerHTML = `
                <svg style="width: 14px; height: 14px; vertical-align: middle; margin-right: 5px;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" fill="currentColor"/>
                </svg>
                正在重新获取环境配置...
            `;
            statusElement.style.color = '#52c41a';

            setTimeout(() => {
                statusElement.innerHTML = `
                    <svg style="width: 14px; height: 14px; vertical-align: middle; margin-right: 5px;" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" fill="currentColor"/>
                    </svg>
                    失败!请检查环境...
                `;
            }, 2000);

        }, 1000);
    });

    // 
    const spinStyle = document.createElement('style');
    spinStyle.textContent = `
        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
    `;
    document.head.appendChild(spinStyle);

    // 
    const description = document.createElement('div');
    description.innerHTML = `
        <h4 style="margin-top: 0;"></h4>
        <br>
        <p style="font-size: 15px;"><strong>说明</strong></p>
        <br>
        <p style="color: #ff0000; line-height: 1.6; font-size: 13px;"><strong>欢迎机构对接合作一手独家资源,顶级质量。可批量导入,可批量查课,顶级质量,自动售后,独家一号一ip。欢迎机构老师同行来谈合作</strong></p>
        <br>
        <p>联系方式Q:417545796</p>
        <br>    
    `;

    // 
    const playButton = document.createElement('button');
    playButton.textContent = '播放';
    playButton.style.cssText = `
        width: 100%;
        padding: 10px;
        background-color: #1890ff;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: background-color 0.3s;
        margin-top: 10px;
        display: none;
    `;

    // 
    const submitButton = document.createElement('button');
    submitButton.textContent = '欢迎各位友商咨询,合作联系方式';
    submitButton.style.cssText = `
        width: 100%;
        padding: 10px;
        background-color: #52c41a;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: background-color 0.3s;
        margin-top: 10px;
    `;

    // 
    titleBar.appendChild(title);
    titleBar.appendChild(closeBtn);
    navBar.appendChild(homeBtn);
    navBar.appendChild(settingsBtn);
    navBar.appendChild(questionBankBtn);
    navBar.appendChild(myBtn);
    content.appendChild(homeContent);
    content.appendChild(settingsContent);
    content.appendChild(questionBankContent);
    content.appendChild(myContent);
    content.appendChild(description);
    content.appendChild(playButton);
    content.appendChild(submitButton);
    floatingWindow.appendChild(titleBar);
    floatingWindow.appendChild(navBar);
    floatingWindow.appendChild(content);
    document.body.appendChild(floatingWindow);

    // 
    settingsContent.style.display = 'none';
    questionBankContent.style.display = 'none';

    // 
    let isDragging = false;
    let offsetX, offsetY;

    titleBar.addEventListener('mousedown', function(e) {
        if (e.target !== closeBtn) {
            isDragging = true;
            const rect = floatingWindow.getBoundingClientRect();
            offsetX = e.clientX - rect.left;
            offsetY = e.clientY - rect.top;
            floatingWindow.style.cursor = 'grabbing';
        }
    });

    document.addEventListener('mousemove', function(e) {
        if (!isDragging) return;

        floatingWindow.style.left = (e.clientX - offsetX) + 'px';
        floatingWindow.style.top = (e.clientY - offsetY) + 'px';
    });


    document.addEventListener('mouseup', function() {
        isDragging = false;
        floatingWindow.style.cursor = 'default';
        titleBar.style.cursor = 'move';
    });

    // 
    closeBtn.addEventListener('click', function() {
        floatingWindow.style.display = 'none';
    });

    // 
    const historyContent = document.createElement('div');
    historyContent.style.display = 'none';

    // 
    const questionBankSubmitBtn = document.getElementById('question-bank-submit-btn');
    const questionBankSubmitMessage = document.getElementById('question-bank-submit-message');

    questionBankSubmitBtn.addEventListener('click', function() {
        // 
        questionBankSubmitMessage.style.display = 'block';

        // 
        setTimeout(() => {
            questionBankSubmitMessage.style.display = 'none';
        }, 3000);

        // 
        console.log('题库信息已提交');
    });

    // 
    const viewProgressBtn = document.getElementById('view-progress-btn');
    const progressInfo = document.getElementById('progress-info');

    viewProgressBtn.addEventListener('click', function() {
        if(progressInfo.style.display === 'none') {
            // 
            progressInfo.style.display = 'block';
            this.textContent = '收缩';
            this.style.backgroundColor = '#391085';

            // 
            document.getElementById('progress-time').textContent = new Date().toLocaleString();
        } else {
            // 
            progressInfo.style.display = 'none';
            this.textContent = '查看课程进度';
            this.style.backgroundColor = '#722ed1';
        }
    });
    // 
    const autoAnswerToggle = document.getElementById('auto-answer-toggle');
    const autoAnswerStatus = document.getElementById('auto-answer-status');

    autoAnswerToggle.addEventListener('change', function() {
        if (this.checked) {
            autoAnswerStatus.textContent = '(当前状态:已开启)';
        } else {
            autoAnswerStatus.textContent = '(当前状态:已关闭)';
        }
    });

    // 
    const nameInput = document.getElementById('name-input');
    const nameStatus = document.getElementById('name-status');

    nameInput.addEventListener('input', function() {
        if(this.value.trim() === '') {
            nameStatus.textContent = '姓名不能为空';
            nameStatus.style.color = '#ff4d4f';
        } else if(this.value.length < 2) {
            nameStatus.textContent = '姓名至少需要2个字符';
            nameStatus.style.color = '#faad14';
        } else {
            nameStatus.textContent = '道友请手下留情!';
            nameStatus.style.color = '#52c41a';
        }
    });
    const buyBtn = document.getElementById('buy-question-bank-btn');
    const buyStatus = document.getElementById('buy-status');

    buyBtn.addEventListener('click', function() {
        // 
        this.style.transform = 'scale(0.95)';
        this.style.backgroundColor = '#cf1322';
        buyStatus.textContent = '正在跳转到Tsing Wo College脚本批量播放...';
        buyStatus.style.color = '#1890ff';

        // 
        setTimeout(() => {
            this.style.transform = 'scale(1)';
            this.style.backgroundColor = '#f5222d';


            window.open('https://qinghy.top', '_blank');

            // 
            setTimeout(() => {
                buyStatus.textContent = '已跳转到ScriptCat脚本批量播放';
                buyStatus.style.color = '#52c41a';
            }, 500);
        }, 300);
    });

    // 
     playButton.addEventListener('click', function() {
        // 
        if(nameInput.value.trim() === '') {
            nameStatus.textContent = '请先输入反馈问题';
            nameStatus.style.color = '#ff4d4f';
            nameInput.focus();
            return;
        }
        const speedSelect = document.getElementById('speed-select');
        const speed = parseInt(speedSelect.value, 10);

        const baiduButton = document.querySelector('input#su');

        if (baiduButton) {
            for (let i = 0; i < speed; i++) {
                setTimeout(() => {
                    baiduButton.click();
                }, i * 500);
            }

            // 记录日志
            console.log('用户姓名:', nameInput.value);
        } else {
            console.error('未找到"内容{}"按钮');
        }
     });

    //  //  
    //  const courseSearch = document.getElementById('course-search');
    //  const searchCourseBtn = document.getElementById('search-course-btn');
    //  const searchStatus = document.getElementById('search-status');
    //  const searchResults = document.getElementById('search-results');
    //
    // //  
    // searchCourseBtn.addEventListener('click', function() {
    //     const keyword = courseSearch.value.trim();
    //
    //     if(keyword === '') {
    //         searchStatus.textContent = '请输入课程名称';
    //         searchStatus.style.color = '#ff4d4f';
    //         courseSearch.focus();
    //         return;
    //     }
    //
    //     //  
    //     searchStatus.textContent = '正在搜索课程: ' + keyword;
    //     searchStatus.style.color = '#1890ff';
    //     this.disabled = true;
    //     this.style.backgroundColor = '#096dd9';
    //
    //     //  
    //     setTimeout(() => {
    //         //  
    //         searchResults.style.display = 'block';
    //
    //         //  
    //         this.disabled = false;
    //         this.style.backgroundColor = '#1890ff';
    //
    //         //  
    //         searchStatus.textContent = '已完成搜索: ' + keyword;
    //         searchStatus.style.color = '#52c41a';
    //
    //         //  
    //         console.log('搜索课程:', keyword);
    //     }, 1500);
    // });

     //  
    const courseSearch = document.getElementById('course-search');
    const searchCourseBtn = document.getElementById('search-course-btn');
    const resetSearchBtn = document.getElementById('reset-search-btn');
    const closeResultsBtn = document.getElementById('close-results-btn');
    const searchStatus = document.getElementById('search-status');
    const searchResults = document.getElementById('search-results');
    const resultsContainer = document.getElementById('results-container');

    //  
    function resetSearch() {
        courseSearch.value = '';
        searchStatus.textContent = '';
        searchResults.style.display = 'none';
        searchCourseBtn.style.backgroundColor = '#1890ff';
        resetSearchBtn.style.backgroundColor = '#d9d9d9';
    }

    //  
    searchCourseBtn.addEventListener('click', function() {
        const keyword = courseSearch.value.trim();

        if(keyword === '') {
            searchStatus.textContent = '请输入课程名称';
            searchStatus.style.color = '#ff4d4f';
            courseSearch.focus();
            return;
        }

        //  
        searchStatus.textContent = '正在搜索课程: ' + keyword;
        searchStatus.style.color = '#1890ff';
        this.style.backgroundColor = '#096dd9';
        resetSearchBtn.style.backgroundColor = '#bfbfbf';

        //  
        setTimeout(() => {
            //  
            const matchedCourse = availableCourses.find(course =>
                course.toLowerCase() === keyword.toLowerCase()
            );

            //  
            searchResults.style.display = 'block';

            //  
            if(matchedCourse) {
                resultsContainer.innerHTML = `
                    <div style="color: #52c41a; margin-bottom: 10px;">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#52c41a" style="vertical-align: middle; margin-right: 8px;">
                            <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
                            <polyline points="22 4 12 14.01 9 11.01"></polyline>
                        </svg>
                        <strong>查询成功!</strong>
                    </div>
                    <p style="color: #666;">已找到课程: <strong>${matchedCourse}</strong></p>
                    <p style="color: #666; margin-top: 10px;">该课程题库包含:</p>
                    <ul style="color: #666; padding-left: 20px;">
                        <li>视频播放</li>
                        <li>考试、全包、慢刷、秒刷、AI课</li>
                        <li>仅阅读、仅作业、积分课、互动分</li>
                        <li>单考试、不考试等</li>
                    </ul>
                `;
                searchStatus.textContent = `成功找到课程: ${matchedCourse}`;
                searchStatus.style.color = '#52c41a';
            } else {
                resultsContainer.innerHTML = `
                    <div style="color: #ff4d4f; margin-bottom: 10px;">
                        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#ff4d4f" style="vertical-align: middle; margin-right: 8px;">
                            <circle cx="12" cy="12" r="10"></circle>
                            <line x1="12" y1="8" x2="12" y2="12"></line>
                            <line x1="12" y1="16" x2="12.01" y2="16"></line>
                        </svg>
                        <strong>未添加该课程</strong>
                    </div>
                    <p style="color: #666;">未找到课程: <strong>${keyword}</strong></p>
                    <p>请联系管理员QQ:417545796 或者Q群:1042758197</p>
                    
                `;
                searchStatus.textContent = `未找到课程: ${keyword}`;
                searchStatus.style.color = '#ff4d4f';
            }

            //  
            this.style.backgroundColor = '#1890ff';
        }, 800);
    });

    //  
    resetSearchBtn.addEventListener('click', function() {
        this.style.backgroundColor = '#bfbfbf';
        setTimeout(() => {
            resetSearch();
        }, 200);
    });

    //  
    closeResultsBtn.addEventListener('click', resetSearch);

    //  
    courseSearch.addEventListener('keypress', function(e) {
        if(e.key === 'Enter') {
            searchCourseBtn.click();
        }
    });

    //  
    const needAnswerToggle = document.getElementById('settings-submit-btn');
    const needAnswerStatus = document.getElementById('submit-message');


    needAnswerToggle.addEventListener('change', function() {
        if (this.checked) {
            needAnswerStatus.textContent = '(当前状态:已开启)';
            //  
            window.open('https://qinghy.top', '_blank');
        } else {
            needAnswerStatus.textContent = '(当前状态:已关闭)';
        }
    });

    //  
    const chapterToggle = document.getElementById('chapter-toggle');
    const chapterStatus = document.getElementById('chapter-status');

    chapterToggle.addEventListener('change', function() {
        if (this.checked) {
            chapterStatus.textContent = '(当前状态:已开启)';
        } else {
            chapterStatus.textContent = '(当前状态:已关闭)';
        }
    });

    //  
    const accuracyProgress = document.getElementById('accuracy-progress');
    const accuracyValue = document.getElementById('accuracy-value');
    const decreaseBtn = document.getElementById('decrease-accuracy');
    const increaseBtn = document.getElementById('increase-accuracy');

    let currentAccuracy = 87;

    function updateAccuracy() {
        accuracyProgress.style.width = `${currentAccuracy}%`;
        accuracyValue.textContent = `${currentAccuracy}%`;

        //  
        if (currentAccuracy < 50) {
            accuracyProgress.style.backgroundColor = '#ff4d4f'; // 红色
        } else if (currentAccuracy < 70) {
            accuracyProgress.style.backgroundColor = '#faad14'; // 橙色
        } else {
            accuracyProgress.style.backgroundColor = '#52c41a'; // 绿色
        }
    }

    decreaseBtn.addEventListener('click', function() {
        currentAccuracy = Math.max(0, currentAccuracy - 5);
        updateAccuracy();
    });

    increaseBtn.addEventListener('click', function() {
        currentAccuracy = Math.min(100, currentAccuracy + 5);
        updateAccuracy();
    });

    //  
    updateAccuracy();

    //  
    const settingsSubmitBtn = document.getElementById('settings-submit-btn');
    const submitMessage = document.getElementById('submit-message');

    settingsSubmitBtn.addEventListener('click', function() {
        //  
        submitMessage.style.display = 'block';

        //  
        setTimeout(() => {
            submitMessage.style.display = 'none';
        }, 3000);

        //  
        console.log('设置已提交:', {
            autoAnswer: autoAnswerToggle.checked,
            needAnswer: needAnswerToggle.checked,
            speed: document.getElementById('speed-select').value,
            chapter: chapterToggle.checked,
            accuracy: currentAccuracy
        });
    });

    //  
    playButton.addEventListener('click', function() {
        const speedSelect = document.getElementById('speed-select');
        const speed = parseInt(speedSelect.value, 10);

        const baiduButton = document.querySelector('input#su');

        if (baiduButton) {
            for (let i = 0; i < speed; i++) {
                setTimeout(() => {
                    baiduButton.click();
                }, i * 500);
            }
        } else {
            console.error('未找到"百度一下"按钮');
        }
    });

    //  
    submitButton.addEventListener('click', function() {
        window.open('https://qinghy.top/', '_blank');
    });

    //  
    const style = document.createElement('style');
    style.textContent = `
        .switch {
            position: relative;
            display: inline-block;
            width: 34px;
            height: 20px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 20px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 2px;
            bottom: 2px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #2196F3;
        }

        input:checked + .slider:before {
            transform: translateX(14px);
        }
    `;
    document.head.appendChild(style);
})();