Greasy Fork

Greasy Fork is available in English.

蛋蛋赞自动下集

自动下一集

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         蛋蛋赞自动下集
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动下一集
// @author       fartpig
// @match        https://www.dandanzan10.top/*
// @match        https://www.dandanzan.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=dandanzan10.top
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js
// @grant        GM_xmlhttpRequest
// @license MIT
// ==/UserScript==
/* global $, Cookies */

(function() {
    'use strict';

    let autoNext = Cookies.get("AutoNext") ? Cookies.get("AutoNext") : false;

    $(".product-header").after("<div style='float: right;'><button id='toggleAutoNext'>" + (autoNext ? '关闭':'打开') +"自动下集</button></div>");

    $(document).on("click", "#toggleAutoNext", function() {
        toggleAutoNext();
    });

    function toggleAutoNext(){
        autoNext = !autoNext;
        $("#toggleAutoNext").text((autoNext ? '关闭':'打开') + "自动下集");
        Cookies.set("AutoNext", autoNext, { expires: 365 });

        alert("ok");
    }

    $(document).ready(function(){
        $("#video")[0].onended = function () {
            if (autoNext) {
               let current = $("li.on");
               let next = $("li.on").next();
               next.children("a").click();
               current.removeClass("on");
               next.addClass("on");
            }
        };
    });
})();