b-live-random-send-test

定时从设置的字幕中随机取出一条在B站直播间发送,需先登录B站账号

目前為 2023-07-11 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/447936/1218580/b-live-random-send-test.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @author          Gamyou
// @version         1.5.7
// ==/UserScript==




window.onload=function(){const e={signText:"打卡",version:"2.4.2",updateFlag:!1,defaultKey:"danmu",configKey:"config",moduleId:"randomSendModule",moduleUrl:"https://greasyfork.org/scripts/447937-bilibili-live-random-send/code/bilibili-live-random-send.js"},t=(t,l)=>{t||(t=e.defaultKey);let o=GM_getValue(t,l);return o||GM_getValue(e.defaultKey)},l=(t,l)=>{t||(t=e.defaultKey),l&&GM_setValue(t,l)},o=e=>{e&&GM_deleteValue(e)},a=e=>{e?GM_notification(e):console.warn("消息对象为空,无效通知")},n=t=>{let l=document.getElementById(e.moduleId);l||((l=document.createElement("script")).id=e.moduleId,l.type="text/javascript",l.text=t,document.head.appendChild(l))},r=()=>{let o=t(e.configKey,null);const a=(new Date).toLocaleDateString()+"/"+(new Date).getHours();if(o||(o={}),a!=o.lastUpdate){console.log("===> 进行脚本更新,最后更新时间:"+o.lastUpdate);const t=new AbortController,r=fetch(e.moduleUrl,{method:"GET",signal:t.signal,cache:"no-store"}),d=setTimeout(()=>t.abort(),4e4);r.then(e=>{if(e.ok)return e.text()}).then(t=>{t&&(d&&clearTimeout(d),n(t),o.script=t,o.lastUpdate=a,l(e.configKey,o),e.updateFlag=!0,console.log("===> 脚本更新完成"))}).catch(e=>console.error("===> 网络请求超时,或其它报错",e))}else e.updateFlag=!0};(()=>{let l=t(e.configKey,null);l&&l.script&&n(l.script),r()})();let d=setInterval(()=>{try{autoSendDanmuModuleLoaded?(clearInterval(d),d=null,setGmNotice(a),setGmGetValue(t),setGmSetValue(l),setGmDelValue(o),setParentData(e),runStart()):console.log("===> 组件初始化中···")}catch(e){console.warn("===> 组件初始化中···"),console.error(e)}},1e3),s=setInterval(()=>{e.updateFlag?(clearInterval(s),s=null):r()},6e4)}();