SAEskip

Um UserScript para a VideoAula do ava.sae.digital ficar 100% Automaticamente

目前為 2025-03-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         SAEskip
// @namespace    https://github.com/teogabrielofc/saeskip
// @version      1.4
// @description  Um UserScript para a VideoAula do ava.sae.digital ficar 100% Automaticamente
// @match        *://ava.sae.digital/_n/*
// @grant        none
// @license GNU GPLv3
// ==/UserScript==

(function() {
    'use strict';

    // Interceptar XMLHttpRequest
    const open = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function(method, url, ...rest) {
        if (method === "POST" && url.includes("apis.sae.digital/ava/answer/video")) {
            this.addEventListener("readystatechange", function() {
                if (this.readyState === 4 && this.responseURL.includes("apis.sae.digital/ava/answer/video")) {
                    console.log("[SAEskip] Modificando video_percentage para 100%");
                }
            });

            const send = this.send;
            this.send = function(body) {
                try {
                    let data = JSON.parse(body);
                    if (data.video_percentage !== undefined) {
                        data.video_percentage = 100;
                        body = JSON.stringify(data);
                    }
                } catch (e) {
                    console.error("[SAEskip] Erro ao modificar request:", e);
                }
                send.call(this, body);
            };
        }
        open.call(this, method, url, ...rest);
    };

    // Interceptar fetch()
    window.fetch = new Proxy(window.fetch, {
        apply: async function(target, thisArg, args) {
            let url = args[0];
            let options = args[1] || {};

            if (url.includes("apis.sae.digital/ava/answer/video") && options.method === "POST") {
                let clone = options.body;

                if (clone) {
                    let bodyText = await clone.text();
                    let bodyJson = JSON.parse(bodyText);

                    if (bodyJson.video_percentage !== undefined) {
                        console.log("[SAEskip] Modificando progresso do vídeo para 100%!");
                        bodyJson.video_percentage = 100;
                        options.body = JSON.stringify(bodyJson);
                    }
                }
            }

            return target.apply(thisArg, [url, options]);
        }
    });

})();