ani gamer tools

動畫瘋, 自動撥放, J 鍵跳過 90S, 自動設定影片速度

当前为 2023-10-01 提交的版本,查看 最新版本

// ==UserScript==
// @name         ani gamer tools
// @version      0.3
// @description  動畫瘋, 自動撥放, J 鍵跳過 90S, 自動設定影片速度
// @author       Vanisoul
// @match        https://ani.gamer.com.tw/*
// @license MIT
// @namespace https://gf.qytechs.cn/users/429936
// ==/UserScript==

const skipKey = "j"; //啟動鍵J
const OPTime = 90; //跳過長度
const videoRate = 1.75; //影片速度

const fullScanKey = "f"; //全螢幕切換
const autoNext = true; //自動切換下一集

let video = null;
let fsi = null;
let snArray = [];

function initVideo(videoI){
    videoI.playbackRate = videoRate;
    getSnList();
}

function getSnList(){
    snArray = [];
    unsafeWindow.$(".season ul li a").each(function() {
        var href = unsafeWindow.$(this).attr('href');
        var sn = href.split('=')[1];
        snArray.push(sn);
    });
}

function goToNextPage() {
    const currentPageIndex = getCurrentPage();
    if (currentPageIndex >= 0 && currentPageIndex < snArray.length - 1) {
        const nextSN = snArray[currentPageIndex + 1];
        window.location.href = '?sn=' + nextSN;
    } else {
        console.log('已經是最後一頁了,無法轉到下一頁。');
    }
}

function getCurrentPage() {
    var currentSN = window.location.search.split('=')[1];
    return snArray.indexOf(currentSN);
}

const interval = setInterval(()=>{
    video = document.getElementById('ani_video_html5_api');
    if (!unsafeWindow.$){
        return;
    }
    const adultClick = unsafeWindow.$._data(unsafeWindow.$("#adult")[0], "events").click;
    if(video && adultClick && adultClick.length !== 0){
        clearInterval(interval);
        adultClick[0].handler(); //同意撥放
        video.addEventListener('play', function() {
            initVideo(video);
        });
        video.addEventListener('ended', function() {
            if(autoNext){
                goToNextPage();
            }
        });
    }
}, 1000)


document.addEventListener('keydown', function(event){
    if(event.key.toLocaleLowerCase() === skipKey && video){
        video.currentTime += OPTime;
    }
    if (event.key.toLocaleLowerCase() === fullScanKey) {
        unsafeWindow.$(".vjs-fullscreen-control").trigger("click");
    }
})

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址