您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
可以開關和選擇每10,30,60秒自動更新彈幕
当前为
// ==UserScript== // @name 巴哈動畫瘋自動更新彈幕 // @namespace https://greasyfork.org/users/179168 // @version 2.1 // @description 可以開關和選擇每10,30,60秒自動更新彈幕 // @author YellowPlus // @run-at document-start // @match *://ani.gamer.com.tw/animeVideo.php?sn=* // @grant GM.getValue // @grant GM.setValue // @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js // ==/UserScript== (async function() { 'use strict'; var t; var timer_seconds = [10, 30, 60]; if (await GM.getValue("index") == null) { await GM.setValue("index", 0); } if (await GM.getValue("switch") == null) { await GM.setValue("switch", true); } document.addEventListener ("DOMContentLoaded", DOM_ContentReady); async function DOM_ContentReady () { var timer_switch = $("<button></button>", {class: "bullet-send-setting", html: '<i class="material-icons">timer</i>'}).click(async()=>{ toggleTimerSwitch(timer_switch, tsecond); }); var timer_second = $("<button></button>", {class: "bullet-send-setting", html: '<span style="font-size: small; font-weight:bold">10s</span>'}).click(async()=>{ await GM.setValue("index", (await GM.getValue("index") + 1) % timer_seconds.length); tsecond = changeTimerSeconds(timer_second, timer_seconds[await GM.getValue("index")]); if (await GM.getValue("switch")) { clearInterval(t); resetInterval(tsecond); } }); $(".bullet-send").prepend(timer_second).prepend(timer_switch); var tsecond = changeTimerSeconds(timer_second, timer_seconds[await GM.getValue("index")]); changeTimerSwitch(timer_switch, tsecond, !await GM.getValue("switch")); } async function changeTimerSwitch(timer_switch, tsecond, flag) { if (flag) { clearInterval(t); timer_switch.find("i").html("timer_off"); await GM.setValue("switch", false); console.log("==> Stopped refreshing comment."); } else { resetInterval(tsecond); timer_switch.find("i").html("timer"); await GM.setValue("switch", true); console.log("==> Started refreshing comment."); } } async function toggleTimerSwitch(timer_switch, tsecond) { changeTimerSwitch(timer_switch, tsecond, await GM.getValue("switch")); } function changeTimerSeconds(timer_second, tsecond) { timer_second.find("span").html(tsecond + "s"); console.log("==> Changed the time of refreshing comment to " + tsecond + " seconds."); return tsecond * 1000; } function resetInterval (tsecond) { t = setInterval(refreshComment, tsecond); } function refreshComment () { $(".refresh").click(); console.log("==> Refreshing comment.", new Date() ); } })();