深圳教师网自动刷公需课(带密码验证)

为了防止滥用,并保证脚本的长期可用,请输入启用密码。

// ==UserScript==
// @name         深圳教师网自动刷公需课(带密码验证)
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  为了防止滥用,并保证脚本的长期可用,请输入启用密码。
// @author       izlx
// @license      Apache-2.0
// @match        https://www.0755tt.com/video?*
// @match        https://m.0755tt.com/video?*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let playbackRate = 1; // 默认播放速度


    const correctHash = '54af2a2960e582263c45971cdd40da4ae31ede1db5395629d910f056479de12d';

    // 添加样式
    const style = document.createElement('style');
    style.textContent = `
        .izlx-dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            z-index: 9999;
            max-width: 90%;
            width: 400px;
            font-family: Arial, sans-serif;
            transition: all 0.3s ease;
        }
        .izlx-dialog h2 {
            margin-top: 0;
            color: #333;
            font-size: 24px;
            text-align: center;
        }
        .izlx-btn {
            display: inline-block;
            padding: 10px 20px;
            margin: 10px 5px;
            border: none;
            border-radius: 5px;
            background-color: #4CAF50;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }
        .izlx-btn:hover {
            background-color: #45a049;
        }
        .izlx-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 9998;
        }
    `;
    document.head.appendChild(style);

    // 简单的 SHA256 哈希函数
    async function sha256(str) {
        const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(str));
        return Array.prototype.map.call(new Uint8Array(buf), x => ('00' + x.toString(16)).slice(-2)).join('');
    }

    // 密码验证功能
    async function verifyPassword() {
        const enteredPassword = prompt('为了防止滥用,并保证脚本的长期可用,请输入启用密码:');
        if (enteredPassword) {
            const hashedPassword = await sha256(enteredPassword);
            if (hashedPassword === correctHash) {
                alert('密码正确,脚本即将启动。');
                showDisclaimerDialog(); // 启动免责声明
            } else {
                alert('密码错误,无法使用该脚本。');
            }
        } else {
            alert('请输入密码。');
        }
    }

    // 创建并显示免责声明对话框
    function showDisclaimerDialog() {
        const overlay = document.createElement('div');
        overlay.classList.add('izlx-overlay');
        document.body.appendChild(overlay);

        const dialog = document.createElement('div');
        dialog.classList.add('izlx-dialog');
        dialog.innerHTML = `
            <h2>免责声明</h2>
            <p>使用此脚本的任何后果由使用者本人承担,作者不对任何因使用该脚本造成的直接或间接损失负责。本脚本仅供学习使用,不得用于非法目的。</p>
            <div class="izlx-btn-group">
                <button id="agreeBtn" class="izlx-btn">同意</button>
            </div>
        `;
        document.body.appendChild(dialog);

        document.getElementById('agreeBtn').addEventListener('click', function() {
            dialog.style.opacity = '0';
            overlay.style.opacity = '0';
            setTimeout(() => {
                dialog.remove();
                overlay.remove();
                showPlaybackRateDialog();
            }, 300);
        });
    }

    // 创建并显示播放速度选择对话框
    function showPlaybackRateDialog() {
        const overlay = document.createElement('div');
        overlay.classList.add('izlx-overlay');
        document.body.appendChild(overlay);

        const dialog = document.createElement('div');
        dialog.classList.add('izlx-dialog');
        dialog.innerHTML = `
            <h2>选择播放速度</h2>
            <div class="izlx-btn-group">
                <button class="izlx-btn rateBtn" data-rate="1">1倍速</button>
                <button class="izlx-btn rateBtn" data-rate="2">2倍速</button>
                <button class="izlx-btn rateBtn" data-rate="4">4倍速</button>
                <button class="izlx-btn rateBtn" data-rate="8">8倍速</button>
                <button class="izlx-btn rateBtn" data-rate="16">16倍速</button>
            </div>
        `;
        document.body.appendChild(dialog);

        dialog.querySelectorAll('.rateBtn').forEach(btn => {
            btn.addEventListener('click', function() {
                playbackRate = parseInt(this.getAttribute('data-rate'));
                dialog.style.opacity = '0';
                overlay.style.opacity = '0';
                setTimeout(() => {
                    dialog.remove();
                    overlay.remove();
                    activateScript();
                }, 300);
            });
        });
    }

    // 激活脚本功能
    function activateScript() {
        setInterval(function(){
            // 自动点击弹窗按钮
            let popupButton = Array.from(document.querySelectorAll('button.el-button.el-button--primary.el-button--medium')).find(el => el.textContent.trim() === '确 定');
            if (popupButton) {
                popupButton.click();
            }
        }, 5000); // 每5秒检测一次

        // 自动设置播放速度为选择的倍速
        setInterval(function(){
            let video = document.querySelector('video');
            if (video && video.playbackRate !== playbackRate) {
                video.playbackRate = playbackRate;
            }
        }, 1000); // 每秒检测一次
    }

    // 启动脚本时先进行密码验证
    verifyPassword();
})();




/*
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.
   ...

5. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Licensed Software (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Licensed Software and assume any risks associated with Your exercise of permissions under this License.

6. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Licensed Software (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
*/