您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to mark the video as watched on Sprints AI
当前为
// ==UserScript== // @name Sprints AI - Mark as Watched // @namespace http://tampermonkey.net/ // @version 1.0 // @description Adds a button to mark the video as watched on Sprints AI // @author UAEpro // @match https://sprints.ai/journeys/learning/* // @grant GM_xmlhttpRequest // @grant GM_getValue // @grant GM_setValue // @license MIT // ==/UserScript== (function () { 'use strict'; function getParameterByName(name) { const urlParams = new URLSearchParams(window.location.search); return urlParams.get(name); } function sendWatchedRequest(itemId) { const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || ''; GM_xmlhttpRequest({ method: "POST", url: "https://sprints.ai/course/1999481/learningStatus", headers: { "User-Agent": navigator.userAgent, "Accept": "*/*", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-CSRF-TOKEN": csrfToken, "X-Requested-With": "XMLHttpRequest", }, data: `item=file_id&item_id=${itemId}&status=true`, onload: function (response) { if (response.status === 200) { alert("Marked as Watched!"); } else { alert("Failed to mark as watched."); } }, onerror: function () { alert("Network error."); } }); } function addWatchedButton() { const button = document.createElement("button"); button.innerText = "Watched"; button.style.position = "fixed"; button.style.bottom = "20px"; button.style.left = "20px"; button.style.padding = "10px 15px"; button.style.backgroundColor = "#28a745"; button.style.color = "white"; button.style.border = "none"; button.style.borderRadius = "5px"; button.style.cursor = "pointer"; button.style.fontSize = "16px"; button.style.zIndex = "1000"; button.onclick = function () { const itemId = getParameterByName("item"); if (!itemId) { alert("Item ID not found in URL."); return; } sendWatchedRequest(itemId); }; document.body.appendChild(button); } addWatchedButton(); })();