Greasy Fork

Greasy Fork is available in English.

南方医科大学爱课平台自动二倍速播放全部视频/Auto Aike 2x Speed Video Player

Automatically play videos at 2x speed on Aike

当前为 2023-03-18 提交的版本,查看 最新版本

// ==UserScript==
// @name 南方医科大学爱课平台自动二倍速播放全部视频/Auto Aike 2x Speed Video Player
// @namespace https://aike.smu.edu.cn/
// @version  1.1
// @description Automatically play videos at 2x speed on Aike
// @author Lily Yu
// @match https://aike.smu.edu.cn/*
// @grant none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    // Define the elements to be manipulated
    var videos, nextPageButton;
    // Wait for the window to load completely
    window.onload = function() {
        // Find all the video elements on the page
        videos = document.querySelectorAll("video");
        // Find the next page button on the page
        nextPageButton = document.querySelector("#next-activity-link");
        // Loop through all the video elements
        for (var i = 0; i < videos.length; i++) {
            // Get the current video element
            var video = videos[i];
            // Play the video at 2x speed
            video.playbackRate = 2;
            video.play();
            // Add an event listener to the video element to detect when it ends
            video.addEventListener("ended", function() {
                // Click the next page button to load a new video
                nextPageButton.click();
            });
        }
    };
})();