b-live-random-send-test

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

目前為 2024-10-09 提交的版本,檢視 最新版本

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

  1. // ==UserScript==
  2. // @version 1.7.1.10
  3. // ==/UserScript==
  4.  
  5.  
  6.  
  7. (function () {
  8. const blobURL = URL.createObjectURL(
  9. new Blob(
  10. [
  11. '(',
  12. function () {
  13. const ids = {};
  14. // 监听message 开始执行定时器或者销毁
  15. self.onmessage = (e) => {
  16. switch (e.data.command) {
  17. case 'interval:start': // 开启定时器
  18. const intervalId = setInterval(() => postMessage({ message: 'interval:tick', id: e.data.id }), e.data.interval);
  19. // postMessage({ message: 'interval:started', id: e.data.id });
  20. ids[e.data.id] = intervalId;
  21. break;
  22. case 'interval:clear': // 销毁
  23. clearInterval(ids[e.data.id]);
  24. postMessage({ message: 'interval:cleared', id: e.data.id });
  25. delete ids[e.data.id];
  26. break;
  27. case 'timeout:start':
  28. const timeoutId = setTimeout(() => postMessage({ message: 'timeout:tick', id: e.data.id }), e.data.timeout);
  29. // postMessage({ message: 'timeout:started', id: e.data.id });
  30. ids[e.data.id] = timeoutId;
  31. break;
  32. case 'timeout:clear':
  33. clearTimeout(ids[e.data.id]);
  34. postMessage({ message: 'timeout:cleared', id: e.data.id });
  35. delete ids[e.data.id];
  36. break;
  37. }
  38. };
  39. }.toString(),
  40. ')()',
  41. ],
  42. { type: 'application/javascript' },
  43. ),
  44. );
  45. const worker = new Worker(blobURL);
  46. URL.revokeObjectURL(blobURL); //用完释放URL对象
  47. const workerTimer = {
  48. id: 0,
  49. callbacks: {},
  50. setInterval: (cb, interval, context) => {
  51. const id = ++workerTimer.id;
  52. workerTimer.callbacks[id] = { fn: cb, context: context };
  53. worker.postMessage({ command: 'interval:start', interval: interval, id: id });
  54. return id;
  55. },
  56. setTimeout: (cb, timeout, context) => {
  57. const id = ++workerTimer.id;
  58. workerTimer.callbacks[id] = { fn: cb, context: context };
  59. worker.postMessage({ command: 'timeout:start', timeout: timeout, id: id });
  60. return id;
  61. },
  62.  
  63. // 监听worker 里面的定时器发送的message 然后执行回调函数
  64. onMessage: (e) => {
  65. switch (e.data.message) {
  66. case 'interval:tick':
  67. case 'timeout:tick':
  68. const callbackItem = workerTimer.callbacks[e.data.id];
  69. if (callbackItem && callbackItem.fn) {
  70. callbackItem.fn.apply(callbackItem.context);
  71. }
  72.  
  73. break;
  74. case 'interval:cleared':
  75. case 'timeout:cleared':
  76. delete workerTimer.callbacks[e.data.id];
  77. break;
  78. }
  79. },
  80.  
  81. // 往worker里面发送销毁指令
  82. clearInterval: (id) => worker.postMessage({ command: 'interval:clear', id: id }),
  83. clearTimeout: (id) => worker.postMessage({ command: 'timeout:clear', id: id }),
  84. };
  85. worker.onmessage = workerTimer.onMessage.bind(workerTimer);
  86.  
  87. let source = {
  88. version: 4,
  89. like: false,
  90. random: true,
  91. usePublic: false,
  92. data1: { available: true, values: ['弹幕①', '弹幕②'] },
  93. data2: { available: true, values: [] },
  94. data3: { available: true, values: [] },
  95. data4: { available: true, values: ['弹幕⑦'] },
  96. data5: { available: true, values: [] }
  97. },
  98. signInCheckbox, hideLoginGuideCheckbox, hideHarunaCheckbox, hideShopCheckbox, noSleepCheckbox, hideGiftControlCheckbox,
  99. hideRoomFeedCheckbox, hideRoomInfoCheckbox, hideNoticeCheckbox, hideFooterCheckbox, lotteryCheckbox, closeLotteryCheckbox,
  100. hesitationCheckbox, hidePrivacyCheckbox, hideRoomStatusCheckbox, setPublicCheckbox, hideBusinessCheckbox,
  101. hideRankListCheckbox, showLiveAreaCheckbox,
  102. group1Checkbox, group2Checkbox, group3Checkbox, group4Checkbox, group5Checkbox,
  103. rdCheckbox, usePublicCheckbox, autoLikeCheckbox,
  104. dmInput, divSetting, dataText1, dataText2, dataText3, dataText4, dataText5, signInput, hesitateInput,
  105. dmButtonSend, beforeSpan, afterSpan, spanApplyMsg, divUpdateInfo, btnStartText,
  106. baseInfo = {}, config = {}, waiters = [], data = [],
  107. sendTimer = null, signInTimer = null, miniCloseTimer, noSleepTimer, noSleepTimeouter, btnLotteryTimer,
  108. divSendBtnTimer, autoLikeTimer, clickLikeBtnTimer,
  109. count = 0, waitCount = 200, arrayIndex = 0, default_timeout = 600,
  110. lotteryChecked = 'lottery_checked', closeLotteryChecked = 'close_lottery_checked', hesitationChecked = 'hesitation_checked',
  111. hesitationExpiry = 'hesitation_expiry', txtStartTask = '开始定时发送任务',
  112. gmNotice = obj => { alert(''); },
  113. getGmValue = (key, defaultValue) => { return null; },
  114. setGmValue = (key, obj) => { console.warn('===> No implementation "setGmValue" method.'); },
  115. delGmValue = key => { console.warn('===> No implementation "delGmValue" method.'); };
  116.  
  117. const version = '1.7.1.1', upodateInfo = '适配发送框新UI,阿B这是在搞事,啥折腾。。', noticeTimeout = 10e3,
  118. icoUrl = 'https://www.bilibili.com/favicon.ico',
  119. // roomId = window.__NEPTUNE_IS_MY_WAIFU__
  120. // ? 0 == window.__NEPTUNE_IS_MY_WAIFU__.roomInitRes.data.short_id
  121. // ? window.__NEPTUNE_IS_MY_WAIFU__.roomInitRes.data.room_id
  122. // : window.__NEPTUNE_IS_MY_WAIFU__.roomInitRes.data.short_id
  123. // : window.location.pathname.replace(/^\/(\S+\/)*/g, ''),
  124. roomId = window.location.pathname.replace(/^\/(\S+\/)*/g, ''),
  125. setGmGetValue = callback => getGmValue = callback,
  126. setGmSetValue = callback => setGmValue = callback,
  127. setGmDelValue = callback => delGmValue = callback,
  128. setGmNotice = callback => gmNotice = callback,
  129. setBaseInfo = obj => baseInfo = obj,
  130. arrayInfo = () => console.info(data),
  131. isNull = str => {
  132. if (!str || str == "") {
  133. return true;
  134. }
  135.  
  136. let regu = "^[ ]+$";
  137. let re = new RegExp(regu);
  138. return re.test(str);
  139. },
  140. compareVersion = (ver1, ver2) => {
  141. if (isNull(ver1)) return -1;
  142. if (isNull(ver2)) return 1;
  143.  
  144. const arr1 = ver1.split('.').map(x => x * 1),
  145. arr2 = ver2.split('.').map(x => x * 1),
  146. len = Math.max(arr1.length, arr2.length);
  147. for (let i = 0; i < len; i++) {
  148. if ((arr1[i] || 0) > (arr2[i] || 0)) return 1;
  149. if ((arr1[i] || 0) < (arr2[i] || 0)) return -1;
  150. }
  151.  
  152. return 0;
  153. },
  154. initCss = () => {
  155. let linkElement = document.createElement('link');
  156. linkElement.rel = 'stylesheet';
  157. linkElement.href = 'https://unpkg.zhimg.com/element-ui/lib/theme-chalk/index.css';
  158. document.head.appendChild(linkElement);
  159.  
  160. // 图标库 https://ionic.io/ionicons
  161. // let scriptElement = document.createElement('script');
  162. // scriptElement.src = 'https://unpkg.com/ionicons@5.5.2/dist/ionicons.js';
  163. // document.head.appendChild(scriptElement);
  164.  
  165. let customerStyle = document.createElement('style');
  166. customerStyle.setAttribute('type', 'text/css');
  167. customerStyle.innerHTML = '.danmu-group-title{font-size:14px;padding-left:2px;color:rgb(18,56,141);display:inline;margin-right:60%;vertical-align:middle;}.danmu-group-textarea{width:98%;min-height:100px;height:16%;margin:1px 0px 4px;border:0px;resize:none;}.el-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#FFF;border:1px solid #DCDFE6;color:#606266;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;margin:0;-webkit-transition:.1s;transition:.1s;font-weight:500;padding:12px 20px;font-size:14px;border-radius:4px}.el-button.is-circle{border-radius:50%;padding:12px}.el-button--mini.is-circle{padding:3px;}.el-button:focus,.el-button:hover{color:#409EFF;border-color:#c6e2ff;background-color:#ecf5ff}.el-icon-close.is-circle{padding:5px;color:#ff0000;border:1px solid #ff0000;margin-left:20px;}.el-icon-check.is-circle{padding:5px;color:#0000ff;border:1px solid #0000ff;margin-left:20px;}input[type="checkbox"]{display:none;}.switch-check{display:inline-block;margin:0 5px;vertical-align:middle;}.switch-check-label{display:inline-block;vertical-align:middle;border:1px solid #bdc3c7;border-radius:60px;width:40px;height:18px;position:relative;transition:all .3s;cursor:pointer;}.switch-check-label:before{width:14px;height:14px;content:"";display:inline-block;background-color:#bdc3c7;border-radius:100%;position:absolute;top:2px;left:4px;transition:all .3s;}.switch-check :checked ~ label{background-color:#26b22b;border-color:#26b22b;}.switch-check :checked ~ label:before{left:22px;background-color:#fff;}.switch-check-group{margin-top:5px;width:95%;}.danmu-random-setting-panel{background-color:#e7f1fb;border-radius:10px;width:100%;height:100%;overflow-y:auto;position:absolute;left:0px;top:0px;z-index:999;display:none;}.danmu-random-setting-panel::-webkit-scrollbar{width:4px;height:4px;}.danmu-random-setting-panel::-webkit-scrollbar-thumb{border-radius:5px;-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.2);background:rgba(0,0,0,0.2);}.danmu-random-setting-panel::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.2);border-radius:0;background:rgba(0,0,0,0.1);}.danmu-random-setting-title{text-align:center;font-size:16px;font-weight:700;color:#1c5adc;line-height:30px;}.danmu-random-setting-title-sub{display:inline-block;color:#ee8b8b;height:24px;vertical-align:sub;-webkit-transform:scale(0.7);}.danmu-random-setting-tips{color:#0b81cc;text-align:center;font-style:italic;}.module-update-info{color:#0b81cc;text-indent:2em;font-size:13px;font-weight:700;margin:8px 0;padding:2px 0;background-color:#ffffff;}.update-info-text{color:#f00;vertical-align:-webkit-baseline-middle;}.danmu-random-setting-bottom{width:100%;line-height:35px;}.danmu-random-switch-button-title{font-size:14px;vertical-align:middle;margin-left:5px;color:#095ca2;cursor:help;}.danmu-random-setting-success-tips{text-align:center;display:inline-block;vertical-align:middle;width:40%;}.danmu-random-setting-success-text{font-size:16px;color:#128712;display:none;}.danmu-random-set-button-container{display:inline-block;vertical-align:middle;}.global-setting-tip{padding-left:10px;color:red;font-size:14px;font-weight:700;cursor:help;}.disabled{color:#ababab;cursor:not-allowed;}.clean-cache-btn{min-width:70px;font-size:14px;border-radius:4px;color:#fff;background:#d99d1b;border:0px;cursor:pointer;vertical-align:middle;line-height:30px;}.clean-cache-btn:hover{background:rgba(217,157,27,0.8);color:#000}.danmu-btn{min-width:65px;height:24px;font-size:12px;border-radius:4px;color:rgb(255,255,255);background:rgb(217,157,27);border:0px;cursor:pointer;line-height:1;display:inline-flex;justify-content:center;align-items:center;}.danmu-btn:hover{background:var(--color)!important;}.danmu-text-span{color:#095ca2;font-size:20px;vertical-align:middle;font-weight:700}.danmu-second-input{width:70px;height:20px;margin:0px 3px;border:0px;border-radius:3px;font-size:18px}.not-display{display:none !important;}';
  168. document.head.appendChild(customerStyle);
  169. },
  170. // initScript = () => {
  171. // let script = document.createElement('script');
  172. // script.type = 'text/javascript';
  173. // script.src = 'https://cdn.jsdelivr.net/npm/crypto-js@4.1.1/crypto-js.js';
  174. // document.head.appendChild(script);
  175. // },
  176. getCurrentTimestamp = () => new Date().getTime(),
  177. send = (msg, index) => {
  178. let dmTextArea = document.getElementById('chat-control-panel-vm').querySelector('textarea');
  179. if (!dmTextArea) {
  180. alert('找不到输入弹幕文本框,请尝试刷新页面');
  181. return;
  182. }
  183. if (!isNull(dmTextArea.value)) {
  184. console.log(`===> 有内容正在编辑,跳过该次发送任务`);
  185. return;
  186. }
  187.  
  188. let btnSend = document.getElementsByClassName('right-action-btn')[0];
  189. if (!btnSend) {
  190. alert('找不到发送按钮,请尝试刷新页面');
  191. return;
  192. }
  193. dmTextArea.value = msg;
  194. dmTextArea.dispatchEvent(new Event('input', { "bubbles": true, "cancelable": true }));
  195. btnSend.click();
  196. // ++count;
  197. // console.log('===> ' + new Date().toLocaleString() + ' 弹幕发送成功 ' + count + ' 次,第【' + index + '】条数据 === ' + msg);
  198. },
  199. randomSort = arr => {
  200. for (let i = 0; i < arr.length; i++) {
  201. const rdIndex = Math.floor(Math.random() * arr.length);
  202. const temp = arr[i];
  203. arr[i] = arr[rdIndex];
  204. arr[rdIndex] = temp;
  205. }
  206.  
  207. return arr;
  208. },
  209. clearWaiters = () => {
  210. for (let i = 0; i < waiters.length; i++) {
  211. workerTimer.clearInterval(waiters[i]);
  212. waiters[i] = null;
  213. }
  214.  
  215. waiters = [];
  216. },
  217. signInFunc = () => {
  218. if (signInCheckbox.checked) {
  219. if (!signInTimer) {
  220. let defaultText = isNull(baseInfo.text) ? baseInfo.text : '打卡';
  221. let timestamp = new Date(new Date(new Date().setDate(new Date().getDate() + 1)).toDateString()).getTime() - getCurrentTimestamp();
  222. console.log('===> 设置凌晨打卡定时器【' + timestamp + '】');
  223. signInput.value = isNull(config.signInText) ? defaultText : config.signInText;
  224. signInTimer = workerTimer.setTimeout(() => {
  225. send(isNull(signInput.value) ? defaultText : signInput.value, 0);
  226. console.log('===> 设置下一次打卡');
  227. workerTimer.clearTimeout(signInTimer);
  228. signInTimer = null;
  229. signInFunc();
  230. }, timestamp);
  231. }
  232. } else if (signInTimer) {
  233. console.log('===> 关闭自动打卡功能');
  234. workerTimer.clearTimeout(signInTimer);
  235. signInTimer = null;
  236. }
  237. },
  238. setSource = obj => {
  239. dataText1.value = obj.data1.values.length ? obj.data1.values.join('|') : [];
  240. dataText2.value = obj.data2.values.length ? obj.data2.values.join('|') : [];
  241. dataText3.value = obj.data3.values.length ? obj.data3.values.join('|') : [];
  242. dataText4.value = obj.data4.values.length ? obj.data4.values.join('|') : [];
  243. dataText5.value = obj.data5.values.length ? obj.data5.values.join('|') : [];
  244. },
  245. runCheckbox = () => {
  246. usePublicFunc();
  247. hideFooterFunc();
  248. hideGiftControlFunc();
  249. hideLoginGuideFunc();
  250. hideHarunaFunc();
  251. hideShopFunc();
  252. hidePrivacyFunc();
  253. hideRoomStatusFunc();
  254. hideBusinessFunc();
  255. hideRankListFunc();
  256. noSleepFunc();
  257. signInFunc();
  258. lotteryFunc();
  259. hesitationFunc();
  260. closeLotteryFunc();
  261. autoLikeFunc();
  262. // autoPlay();
  263. hideRoomFeedFunc();
  264. hideRoomInfoFunc();
  265. hideNoticeFunc();
  266. showLiveAreaFunc();
  267. let hideTimeout = workerTimer.setTimeout(() => {
  268. workerTimer.clearTimeout(hideTimeout);
  269. hideRoomFeedFunc();
  270. hideRoomInfoFunc();
  271. hideNoticeFunc();
  272. showLiveAreaFunc();
  273. }, 1e3);
  274. },
  275. setOperationSetting = () => {
  276. setPublicCheckbox.checked = false;
  277. rdCheckbox.checked = source.random;
  278. autoLikeCheckbox.checked = source.like;
  279. usePublicCheckbox.checked = source.usePublic;
  280. dmInput.value = source.interval || default_timeout;
  281. group1Checkbox.checked = source.data1.available;
  282. group2Checkbox.checked = source.data2.available;
  283. group3Checkbox.checked = source.data3.available;
  284. group4Checkbox.checked = source.data4.available;
  285. group5Checkbox.checked = source.data5.available;
  286.  
  287. signInCheckbox.checked = config.autoSignIn;
  288. noSleepCheckbox.checked = config.noSleep;
  289. hideLoginGuideCheckbox.checked = config.hideLoginGuide;
  290. hideHarunaCheckbox.checked = config.hideHaruna;
  291. hideShopCheckbox.checked = config.hideShop;
  292. hideGiftControlCheckbox.checked = config.hideGift;
  293. hideRoomFeedCheckbox.checked = config.hideRoomFeed;
  294. hideRoomInfoCheckbox.checked = config.hideRoomInfo;
  295. hideNoticeCheckbox.checked = config.hideNotice;
  296. hideFooterCheckbox.checked = config.hideFooter;
  297. lotteryCheckbox.checked = config.lottery;
  298. hesitationCheckbox.checked = config.hesitation;
  299. closeLotteryCheckbox.checked = config.closeLottery;
  300. hidePrivacyCheckbox.checked = config.noPrivacy;
  301. hideRoomStatusCheckbox.checked = config.hideWatermark;
  302. hideBusinessCheckbox.checked = config.hideBusiness;
  303. hideRankListCheckbox.checked = config.hideRankList;
  304. showLiveAreaCheckbox.checked = config.showLiveArea;
  305. runCheckbox();
  306. },
  307. openSetting = () => divSetting.style.display = 'block',
  308. closeSetting = () => {
  309. setOperationSetting();
  310. divSetting.style.display = 'none';
  311. },
  312. initData = () => {
  313. if (source.data1.values.length <= 0
  314. && source.data2.values.length <= 0
  315. && source.data3.values.length <= 0
  316. && source.data4.values.length <= 0
  317. && source.data5.values.length <= 0) {
  318. return data ? data : [];
  319. }
  320.  
  321. let result = [];
  322. result = source.data1.available ? result.concat(source.data1.values) : result;
  323. result = source.data2.available ? result.concat(source.data2.values) : result;
  324. result = source.data3.available ? result.concat(source.data3.values) : result;
  325. result = source.data4.available ? result.concat(source.data4.values) : result;
  326. result = source.data5.available ? result.concat(source.data5.values) : result;
  327. data = result;
  328. rdCheckbox.checked ? data = randomSort(result) : arrayIndex = 0;
  329. },
  330. flashMsg = (txt, back, color) => {
  331. spanApplyMsg.textContent = txt;
  332. spanApplyMsg.style.display = 'block';
  333. if (color) {
  334. spanApplyMsg.style.color = color;
  335. }
  336. else {
  337. spanApplyMsg.style.color = '#128712';
  338. }
  339.  
  340. let hideTipTimer = workerTimer.setTimeout(() => {
  341. workerTimer.clearTimeout(hideTipTimer);
  342. spanApplyMsg.style.display = 'none';
  343. spanApplyMsg.textContent = '';
  344. if (back) {
  345. divSetting.style.display = 'none';
  346. }
  347. }, 1.5e3);
  348. },
  349. save = () => {
  350. if (!baseInfo || isNull(baseInfo.default) || isNull(baseInfo.config)) {
  351. flashMsg('保存失败', false, 'red');
  352. return;
  353. }
  354. if (baseInfo.config) {
  355. config.autoSignIn = signInCheckbox.checked;
  356. config.signInText = signInput.value;
  357. config.noSleep = noSleepCheckbox.checked;
  358. config.hideLoginGuide = hideLoginGuideCheckbox.checked;
  359. config.hideHaruna = hideHarunaCheckbox.checked;
  360. config.hideShop = hideShopCheckbox.checked;
  361. config.hideGift = hideGiftControlCheckbox.checked;
  362. config.hideRoomFeed = hideRoomFeedCheckbox.checked;
  363. config.hideRoomInfo = hideRoomInfoCheckbox.checked;
  364. config.hideNotice = hideNoticeCheckbox.checked;
  365. config.hideFooter = hideFooterCheckbox.checked;
  366. config.lottery = lotteryCheckbox.checked;
  367. window.localStorage.setItem(lotteryChecked, lotteryCheckbox.checked);
  368. config.hesitation = hesitationCheckbox.checked;
  369. window.localStorage.setItem(hesitationChecked, hesitationCheckbox.checked);
  370. config.hesitationExpiry = hesitateInput.value;
  371. window.localStorage.setItem(hesitationExpiry, hesitateInput.value);
  372. config.closeLottery = closeLotteryCheckbox.checked;
  373. window.localStorage.setItem(closeLotteryChecked, config.closeLottery);
  374. config.noPrivacy = hidePrivacyCheckbox.checked;
  375. config.hideWatermark = hideRoomStatusCheckbox.checked;
  376. config.hideBusiness = hideBusinessCheckbox.checked;
  377. config.hideRankList = hideRankListCheckbox.checked;
  378. config.showLiveArea = showLiveAreaCheckbox.checked;
  379. setGmValue(baseInfo.config, config);
  380. }
  381.  
  382. let v1 = isNull(dataText1.value) ? [] : dataText1.value.split('|'),
  383. v2 = isNull(dataText2.value) ? [] : dataText2.value.split('|'),
  384. v3 = isNull(dataText3.value) ? [] : dataText3.value.split('|'),
  385. v4 = isNull(dataText4.value) ? [] : dataText4.value.split('|'),
  386. v5 = isNull(dataText5.value) ? [] : dataText5.value.split('|');
  387. source.interval = dmInput.value;
  388. source.random = rdCheckbox.checked;
  389. source.like = autoLikeCheckbox.checked;
  390. source.usePublic = usePublicCheckbox.checked;
  391. source.data1.available = group1Checkbox.checked;
  392. source.data2.available = group2Checkbox.checked;
  393. source.data3.available = group3Checkbox.checked;
  394. source.data4.available = group4Checkbox.checked;
  395. source.data5.available = group5Checkbox.checked;
  396. if (!usePublicCheckbox.checked) {
  397. source.data1.values = v1;
  398. source.data2.values = v2;
  399. source.data3.values = v3;
  400. source.data4.values = v4;
  401. source.data5.values = v5;
  402. }
  403. setGmValue(roomId, source);
  404. if (setPublicCheckbox.checked) {
  405. let ps = {data1:{},data2:{},data3:{},data4:{},data5:{}};
  406. ps.data1.values = v1;
  407. ps.data2.values = v2;
  408. ps.data3.values = v3;
  409. ps.data4.values = v4;
  410. ps.data5.values = v5;
  411. setGmValue(baseInfo.default, ps);
  412. }
  413. if (usePublicCheckbox.checked) {
  414. source.data1.values = v1;
  415. source.data2.values = v2;
  416. source.data3.values = v3;
  417. source.data4.values = v4;
  418. source.data5.values = v5;
  419. }
  420. initData();
  421. flashMsg('设置成功', true);
  422. },
  423. cleanCache = () => {
  424. if (baseInfo.config && config) {
  425. config.script = '';
  426. config.moduleVersion = '0.0.0';
  427. config.lastUpdate = '清除脚本缓存';
  428. setGmValue(baseInfo.config, config);
  429. flashMsg('清除成功');
  430. } else {
  431. console.warn('元数据丢失');
  432. flashMsg('操作失败', false, 'red');
  433. }
  434. },
  435. danmu = () => {
  436. if (data.length < 1) {
  437. // gmNotice({
  438. // text: '请任意在一个分组里输入一条弹幕',
  439. // title: '没有弹幕数据,请先设置',
  440. // image: icoUrl,
  441. // highlight: true,
  442. // timeout: noticeTimeout
  443. // });
  444. alert('请先设置弹幕');
  445. return false;
  446. }
  447. if (rdCheckbox.checked) {
  448. arrayIndex = Math.floor((Math.random() * data.length));
  449. }
  450.  
  451. send(data[arrayIndex], arrayIndex);
  452. ++arrayIndex;
  453. if (arrayIndex >= data.length) {
  454. arrayIndex = 0;
  455. }
  456.  
  457. return true;
  458. },
  459. offOrOn = () => {
  460. let timeout = 0;
  461. if (sendTimer) {
  462. workerTimer.clearInterval(sendTimer);
  463. sendTimer = null;
  464. dmInput.removeAttribute("disabled");
  465. if (btnStartText) {
  466. dmButtonSend.style.removeProperty('background');
  467. dmButtonSend.style.removeProperty('--color');
  468. btnStartText.textContent = '开始';
  469. }
  470. else {
  471. dmButtonSend.style.removeProperty('color');
  472. dmButtonSend.title = txtStartTask;
  473. }
  474. } else {
  475. timeout = (dmInput.value || default_timeout) * 1e3;
  476. if (!danmu()) {
  477. return;
  478. }
  479.  
  480. sendTimer = workerTimer.setInterval(danmu, timeout);
  481. dmInput.setAttribute('disabled', 'disabled');
  482. if (btnStartText) {
  483. dmButtonSend.style.background = 'rgba(255,0,0,1)';
  484. dmButtonSend.style.setProperty('--color', 'rgba(255,0,0,0.8)');
  485. btnStartText.textContent = '停止';
  486. }
  487. else {
  488. dmButtonSend.style.color = 'rgb(255 102 153)';
  489. dmButtonSend.title = '停止定时发送任务';
  490. }
  491. }
  492. },
  493. createSwitch = (id, txt, title, func, container, indent, width, hidden, rear, disabled) => {
  494. let checkbox = document.createElement('input');
  495. checkbox.type = 'checkbox';
  496. checkbox.id = id;
  497. checkbox.checked = false;
  498. if (func && !disabled) {
  499. checkbox.addEventListener('click', func);
  500. }
  501.  
  502. let lblCheckbox = document.createElement('label');
  503. lblCheckbox.setAttribute('for', id);
  504. lblCheckbox.classList.add('switch-check-label');
  505.  
  506. let descSpan = document.createElement('span');
  507. descSpan.textContent = txt;
  508. descSpan.title = title;
  509. descSpan.classList.add('danmu-random-switch-button-title');
  510. if (disabled) {
  511. checkbox.disabled = true;
  512. checkbox.classList.add('disabled');
  513. lblCheckbox.classList.add('disabled');
  514. descSpan.classList.add('disabled');
  515. }
  516.  
  517. let divCheckbox = document.createElement('div');
  518. divCheckbox.id = id + 'Div';
  519. divCheckbox.classList.add('switch-check');
  520. divCheckbox.classList.add('switch-check-group');
  521. divCheckbox.appendChild(checkbox);
  522. divCheckbox.appendChild(lblCheckbox);
  523. divCheckbox.appendChild(descSpan);
  524. if (!isNull(indent)) {
  525. divCheckbox.style.marginLeft = indent;
  526. }
  527. if (!isNull(width)) {
  528. divCheckbox.style.width = width;
  529. }
  530. if (hidden) {
  531. divCheckbox.style.setProperty('display', 'none');
  532. }
  533. if (rear) {
  534. divCheckbox.appendChild(rear);
  535. }
  536.  
  537. container.appendChild(divCheckbox);
  538. return checkbox;
  539. },
  540. buildPanel = () => {
  541. /* ----------------------------------------- head ----------------------------------------- */
  542. let divSettingTitle = document.createElement('div');
  543. divSettingTitle.textContent = '弹幕设置';
  544. divSettingTitle.classList.add('danmu-random-setting-title');
  545.  
  546. let divSub = document.createElement('div');
  547. divSub.textContent = version;
  548. divSub.classList.add('danmu-random-setting-title-sub');
  549. divSettingTitle.appendChild(divSub);
  550.  
  551. let divTip = document.createElement('div');
  552. divTip.classList.add('danmu-random-setting-tips');
  553. divTip.innerHTML = '任一分组内输入弹幕即可,多条用<span style="color:#dc6b07;margin:0 2px 0 4px;font-weight:700;font-style:normal;">竖线</span>分隔';
  554.  
  555. divUpdateInfo = document.createElement('div');
  556. divUpdateInfo.classList.add('module-update-info');
  557. divUpdateInfo.innerHTML = `<span class="update-info-text">消息提示:</span><span class="update-info-text" style="color:#0f6ba6;">${baseInfo.msg || upodateInfo}</span>`;
  558. /* ----------------------------------------- head ----------------------------------------- */
  559.  
  560. /* ----------------------------------------- textarea 1 ----------------------------------------- */
  561. let divText1 = document.createElement('div');
  562. divText1.textContent = '分组 1 :';
  563. divText1.classList.add('danmu-group-title');
  564.  
  565. group1Checkbox = document.createElement('input');
  566. group1Checkbox.type = 'checkbox';
  567. group1Checkbox.id = 'group1Checkbox';
  568. group1Checkbox.checked = true;
  569.  
  570. let lblGroup1Checkbox = document.createElement('label');
  571. lblGroup1Checkbox.setAttribute('for', 'group1Checkbox');
  572. lblGroup1Checkbox.classList.add('switch-check-label');
  573.  
  574. let divGroup1Checkbox = document.createElement('div');
  575. divGroup1Checkbox.classList.add('switch-check');
  576. divGroup1Checkbox.appendChild(group1Checkbox);
  577. divGroup1Checkbox.appendChild(lblGroup1Checkbox);
  578.  
  579. dataText1 = document.createElement('textarea');
  580. dataText1.classList.add('danmu-group-textarea');
  581. dataText1.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  582. /* ----------------------------------------- textarea 1 ----------------------------------------- */
  583.  
  584. /* ----------------------------------------- textarea 2 ----------------------------------------- */
  585. let divText2 = document.createElement('div');
  586. divText2.textContent = '分组 2 :';
  587. divText2.classList.add('danmu-group-title');
  588.  
  589. group2Checkbox = document.createElement('input');
  590. group2Checkbox.type = 'checkbox';
  591. group2Checkbox.id = 'group2Checkbox';
  592. group2Checkbox.checked = true;
  593.  
  594. let lblGroup2Checkbox = document.createElement('label');
  595. lblGroup2Checkbox.setAttribute('for', 'group2Checkbox');
  596. lblGroup2Checkbox.classList.add('switch-check-label');
  597.  
  598. let divGroup2Checkbox = document.createElement('div');
  599. divGroup2Checkbox.classList.add('switch-check');
  600. divGroup2Checkbox.appendChild(group2Checkbox);
  601. divGroup2Checkbox.appendChild(lblGroup2Checkbox);
  602.  
  603. dataText2 = document.createElement('textarea');
  604. dataText2.classList.add('danmu-group-textarea');
  605. dataText2.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  606. /* ----------------------------------------- textarea 2 ----------------------------------------- */
  607.  
  608. /* ----------------------------------------- textarea 3 ----------------------------------------- */
  609. let divText3 = document.createElement('div');
  610. divText3.textContent = '分组 3 :';
  611. divText3.classList.add('danmu-group-title');
  612.  
  613. group3Checkbox = document.createElement('input');
  614. group3Checkbox.type = 'checkbox';
  615. group3Checkbox.id = 'group3Checkbox';
  616. group3Checkbox.checked = true;
  617.  
  618. let lblGroup3Checkbox = document.createElement('label');
  619. lblGroup3Checkbox.setAttribute('for', 'group3Checkbox');
  620. lblGroup3Checkbox.classList.add('switch-check-label');
  621.  
  622. let divGroup3Checkbox = document.createElement('div');
  623. divGroup3Checkbox.classList.add('switch-check');
  624. divGroup3Checkbox.appendChild(group3Checkbox);
  625. divGroup3Checkbox.appendChild(lblGroup3Checkbox);
  626.  
  627. dataText3 = document.createElement('textarea');
  628. dataText3.classList.add('danmu-group-textarea');
  629. dataText3.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  630. /* ----------------------------------------- textarea 3 ----------------------------------------- */
  631.  
  632. /* ----------------------------------------- textarea 4 ----------------------------------------- */
  633. let divText4 = document.createElement('div');
  634. divText4.textContent = '分组 4 :';
  635. divText4.classList.add('danmu-group-title');
  636.  
  637. group4Checkbox = document.createElement('input');
  638. group4Checkbox.type = 'checkbox';
  639. group4Checkbox.id = 'group4Checkbox';
  640. group4Checkbox.checked = true;
  641.  
  642. let lblGroup4Checkbox = document.createElement('label');
  643. lblGroup4Checkbox.setAttribute('for', 'group4Checkbox');
  644. lblGroup4Checkbox.classList.add('switch-check-label');
  645.  
  646. let divGroup4Checkbox = document.createElement('div');
  647. divGroup4Checkbox.classList.add('switch-check');
  648. divGroup4Checkbox.appendChild(group4Checkbox);
  649. divGroup4Checkbox.appendChild(lblGroup4Checkbox);
  650.  
  651. dataText4 = document.createElement('textarea');
  652. dataText4.classList.add('danmu-group-textarea');
  653. dataText4.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  654. /* ----------------------------------------- textarea 4 ----------------------------------------- */
  655.  
  656. /* ----------------------------------------- textarea 5 ----------------------------------------- */
  657. let divText5 = document.createElement('div');
  658. divText5.textContent = '分组 5 :';
  659. divText5.classList.add('danmu-group-title');
  660.  
  661. group5Checkbox = document.createElement('input');
  662. group5Checkbox.type = 'checkbox';
  663. group5Checkbox.id = 'group5Checkbox';
  664. group5Checkbox.checked = true;
  665.  
  666. let lblGroup5Checkbox = document.createElement('label');
  667. lblGroup5Checkbox.setAttribute('for', 'group5Checkbox');
  668. lblGroup5Checkbox.classList.add('switch-check-label');
  669.  
  670. let divGroup5Checkbox = document.createElement('div');
  671. divGroup5Checkbox.classList.add('switch-check');
  672. divGroup5Checkbox.appendChild(group5Checkbox);
  673. divGroup5Checkbox.appendChild(lblGroup5Checkbox);
  674.  
  675. dataText5 = document.createElement('textarea');
  676. dataText5.classList.add('danmu-group-textarea');
  677. dataText5.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  678. /* ----------------------------------------- textarea 5 ----------------------------------------- */
  679.  
  680.  
  681. /* ----------------------------------------- send interval ----------------------------------------- */
  682. beforeSpan = document.createElement('span');
  683. beforeSpan.textContent = '设置弹幕每';
  684. beforeSpan.classList.add('danmu-text-span');
  685. beforeSpan.style.marginLeft = '4px';
  686.  
  687. dmInput = document.createElement('input');
  688. dmInput.value = default_timeout;
  689. dmInput.classList.add('danmu-second-input');
  690. dmInput.setAttribute('oninput', "this.value = this.value.replace(/[^0-9]/g, '')");
  691.  
  692. afterSpan = document.createElement('span');
  693. afterSpan.textContent = '秒发送一次';
  694. afterSpan.classList.add('danmu-text-span');
  695. afterSpan.style.marginRight = '4px';
  696.  
  697. let divSendInterval = document.createElement('div');
  698. divSendInterval.appendChild(beforeSpan);
  699. divSendInterval.appendChild(dmInput);
  700. divSendInterval.appendChild(afterSpan);
  701. /* ----------------------------------------- send interval ----------------------------------------- */
  702.  
  703.  
  704. /* ----------------------------------------- different room setting ----------------------------------------- */
  705. let divRoomSetting = document.createElement('div');
  706. divRoomSetting.appendChild(divText1);
  707. divRoomSetting.appendChild(divGroup1Checkbox);
  708. divRoomSetting.appendChild(dataText1);
  709. divRoomSetting.appendChild(divText2);
  710. divRoomSetting.appendChild(divGroup2Checkbox);
  711. divRoomSetting.appendChild(dataText2);
  712. divRoomSetting.appendChild(divText3);
  713. divRoomSetting.appendChild(divGroup3Checkbox);
  714. divRoomSetting.appendChild(dataText3);
  715. divRoomSetting.appendChild(divText4);
  716. divRoomSetting.appendChild(divGroup4Checkbox);
  717. divRoomSetting.appendChild(dataText4);
  718. divRoomSetting.appendChild(divText5);
  719. divRoomSetting.appendChild(divGroup5Checkbox);
  720. divRoomSetting.appendChild(dataText5);
  721. divRoomSetting.appendChild(divSendInterval);
  722. rdCheckbox = createSwitch('rdCheckbox', '随机从上面的弹幕中选出一条发送', '将合并所有分组数据,从中随机选出一条发送', null, divRoomSetting);
  723. usePublicCheckbox = createSwitch('usePublicCheckbox', '使用共用弹幕源', '使用设置为共用弹幕作为弹幕源', usePublicFunc, divRoomSetting);
  724. autoLikeCheckbox = createSwitch('autoLikeCheckbox', '自动点赞该直播间', '每15秒内随机一个时间点点赞一次直播间(点赞1000次大概需要4小时)', autoLikeFunc, divRoomSetting, null, null, null, null);
  725.  
  726. let operationDescription = document.createElement('div');
  727. operationDescription.textContent = '以上设置对应各个直播间独立保存,无需刷新';
  728. operationDescription.title = '请点击设置面板底下的“✓”进行保存';
  729. operationDescription.classList.add('global-setting-tip');
  730. operationDescription.classList.add('switch-check-group');
  731. divRoomSetting.appendChild(operationDescription);
  732. /* ----------------------------------------- different room setting ----------------------------------------- */
  733.  
  734. /* ----------------------------------------- global setting ----------------------------------------- */
  735. let divGlobalSetting = document.createElement('div');
  736. divGlobalSetting.style.margin = '20px 0 10px';
  737.  
  738. operationDescription = document.createElement('div');
  739. operationDescription.textContent = '以下设置,需刷新其它直播间才能适用';
  740. operationDescription.title = '请点击设置面板底下的“✓”进行保存';
  741. operationDescription.classList.add('global-setting-tip');
  742. operationDescription.classList.add('switch-check-group');
  743. divGlobalSetting.appendChild(operationDescription);
  744.  
  745. signInput = document.createElement('input');
  746. signInput.id = 'signInputText';
  747. signInput.style.border = '0';
  748. signInput.style.width = '90px';
  749. signInput.setAttribute('placeholder', '输入打卡的文字');
  750.  
  751. hesitateInput = document.createElement('input');
  752. hesitateInput.style.border = '0';
  753. hesitateInput.style.width = '55px';
  754. hesitateInput.setAttribute('placeholder', '单位:秒');
  755. hesitateInput.setAttribute('oninput', "this.value = this.value.replace(/[^0-9]/g, '')");
  756.  
  757. setPublicCheckbox = createSwitch('setPublicCheckbox', '设为共用弹幕源', '把这个直播间的弹幕共享给其它直播间使用,先后设置时,后面的会覆盖前面的设置', setPublicFunc, divGlobalSetting);
  758. signInCheckbox = createSwitch('signInCheckbox', '打卡弹幕(需登录(不可用)):', '每日零点发送一条打卡弹幕', signInFunc, divGlobalSetting, null, null, false, signInput);
  759. lotteryCheckbox = createSwitch('lotteryCheckbox', '自动参与天选时刻抽奖(需登录(不可用))', '自动点击参与按钮,请确保已经登录(不可用)了阿B账号', lotteryFunc, divGlobalSetting);
  760. hesitationCheckbox = createSwitch('hesitationCheckbox', '随机犹豫期:', '(尝试应对人机校验,不一定有效,随机的范围:(0, 填的数字])不立刻参与天选时刻,这期间可以手动处理,免得自动参加后后悔(时间单位:秒)', hesitationFunc, divGlobalSetting, '23px', '90%', true, hesitateInput);
  761. closeLotteryCheckbox = createSwitch('closeLotteryCheckbox', '关闭天选时刻', '关闭天选时刻弹窗', closeLotteryFunc, divGlobalSetting);
  762. hideGiftControlCheckbox = createSwitch('hideGiftControlCheckbox', '隐藏礼物栏', '隐藏播放器底部的礼物栏', hideGiftControlFunc, divGlobalSetting);
  763. noSleepCheckbox = createSwitch('noSleepCheckbox', '防止直播间休眠', '防止直播间页面一段时间没操作之后进入休眠', noSleepFunc, divGlobalSetting, null, null, false);
  764. hideLoginGuideCheckbox = createSwitch('hideLoginGuideCheckbox', '隐藏播放器底部登录(不可用)提示', '隐藏未登录(不可用)时播放器底部显示的登录(不可用)提示', hideLoginGuideFunc, divGlobalSetting);
  765. hideHarunaCheckbox = createSwitch('hideHarunaCheckbox', '隐藏看板娘立绘', '隐藏直播间Haruna立绘', hideHarunaFunc, divGlobalSetting);
  766. hideShopCheckbox = createSwitch('hideShopCheckbox', '隐藏购物提示', '隐藏播放器左上角的商店购物提示', hideShopFunc, divGlobalSetting);
  767. hideRoomFeedCheckbox = createSwitch('hideRoomFeedCheckbox', '隐藏主播动态', '隐藏播放器底下主播的动态栏', hideRoomFeedFunc, divGlobalSetting);
  768. hideRoomInfoCheckbox = createSwitch('hideRoomInfoCheckbox', '隐藏简介、荣誉,或直播间推荐列表', '隐藏播放器底下直播间推荐列表,不登录(不可用)账号显示为主播的荣耀和简介', hideRoomInfoFunc, divGlobalSetting);
  769. hideNoticeCheckbox = createSwitch('hideNoticeCheckbox', '隐藏主播公告', '隐藏弹幕列表底下主播的公告', hideNoticeFunc, divGlobalSetting);
  770. hideFooterCheckbox = createSwitch('hideFooterCheckbox', '隐藏直播间页脚', '隐藏直播间底部的网页页脚', hideFooterFunc, divGlobalSetting);
  771. hidePrivacyCheckbox = createSwitch('hidePrivacyCheckbox', '隐藏隐私提示对话框', '隐藏隐私提示登录(不可用)的对话框,被打码的昵称不保证变回正常', hidePrivacyFunc, divGlobalSetting);
  772. hideRoomStatusCheckbox = createSwitch('hideRoomStatusCheckbox', '隐藏直播水印', '隐藏播放器左上角的直播水印', hideRoomStatusFunc, divGlobalSetting);
  773. hideBusinessCheckbox = createSwitch('hideBusinessCheckbox', '隐藏商业性互动', '隐藏全站广播、PK、连MIC、连视频等', hideBusinessFunc, divGlobalSetting);
  774. hideRankListCheckbox = createSwitch('hideRankListCheckbox', '隐藏滚动排行榜', '隐藏顶部的人气榜、航海榜、礼物星球等', hideRankListFunc, divGlobalSetting);
  775. showLiveAreaCheckbox = createSwitch('showLiveArea', '显示直播分区', '显示直播间所属的直播分区', showLiveAreaFunc, divGlobalSetting);
  776. /* ----------------------------------------- global setting ----------------------------------------- */
  777.  
  778. /* ----------------------------------------- operation msg ----------------------------------------- */
  779. spanApplyMsg = document.createElement('span');
  780. spanApplyMsg.classList.add('danmu-random-setting-success-text');
  781.  
  782. let divApplyMsg = document.createElement('div');
  783. divApplyMsg.classList.add('danmu-random-setting-success-tips');
  784. divApplyMsg.appendChild(spanApplyMsg);
  785. /* ----------------------------------------- operation msg ----------------------------------------- */
  786. /* ----------------------------------------- clean cache ----------------------------------------- */
  787. let cleanCacheBtn = document.createElement('button');
  788. cleanCacheBtn.style.setProperty('display', 'none');
  789. cleanCacheBtn.textContent = '清除缓存';
  790. cleanCacheBtn.classList.add('clean-cache-btn');
  791. cleanCacheBtn.addEventListener('click', cleanCache);
  792. /* ----------------------------------------- clean cache ----------------------------------------- */
  793.  
  794. /* ----------------------------------------- save and close button ----------------------------------------- */
  795. let btnSave = document.createElement('i');
  796. btnSave.setAttribute('title', '保存');
  797. btnSave.style.padding = '5px';
  798. btnSave.classList.add('el-button');
  799. btnSave.classList.add('el-icon-check');
  800. btnSave.classList.add('is-circle');
  801. btnSave.addEventListener('click', save);
  802.  
  803. let btnClose = document.createElement('i');
  804. btnClose.setAttribute('title', '关闭');
  805. btnClose.style.padding = '5px';
  806. btnClose.classList.add('el-button');
  807. btnClose.classList.add('el-icon-close');
  808. btnClose.classList.add('is-circle');
  809. btnClose.addEventListener('click', closeSetting);
  810.  
  811. let divBtnSetting = document.createElement('div');
  812. divBtnSetting.classList.add('danmu-random-set-button-container');
  813. divBtnSetting.appendChild(cleanCacheBtn);
  814. divBtnSetting.appendChild(btnSave);
  815. divBtnSetting.appendChild(btnClose);
  816. /* ----------------------------------------- save and close button ----------------------------------------- */
  817.  
  818. /* ----------------------------------------- container ----------------------------------------- */
  819. let divBottomContainer = document.createElement('div');
  820. divBottomContainer.classList.add('danmu-random-setting-bottom');
  821. divBottomContainer.appendChild(divApplyMsg);
  822. divBottomContainer.appendChild(divBtnSetting);
  823.  
  824. let divOtherContainer = document.createElement('div');
  825. divOtherContainer.id = 'otherContainer';
  826.  
  827. let divContainer = document.createElement('div');
  828. divContainer.style.height = 'calc(98% - 30px - 25px)';
  829. divContainer.appendChild(divRoomSetting);
  830. divContainer.appendChild(divGlobalSetting);
  831. divContainer.appendChild(divOtherContainer);
  832. divContainer.appendChild(divBottomContainer);
  833. /* ----------------------------------------- container ----------------------------------------- */
  834.  
  835. divSetting = document.createElement('div');
  836. divSetting.id = 'danmu-setting-panel';
  837. divSetting.classList.add('danmu-random-setting-panel');
  838. divSetting.appendChild(divSettingTitle);
  839. divSetting.appendChild(divUpdateInfo);
  840. divSetting.appendChild(divTip);
  841. divSetting.appendChild(divContainer);
  842.  
  843. let asideAreaVm = document.getElementById('aside-area-vm');
  844. asideAreaVm.appendChild(divSetting);
  845.  
  846. },
  847. btnStart = btn => {
  848. btnStartText = document.createElement('span');
  849. btnStartText.textContent = '开始';
  850. btnStartText.title = txtStartTask;
  851. btnStartText.classList.add('txt');
  852.  
  853. dmButtonSend = document.createElement('button');
  854. dmButtonSend.title = txtStartTask;
  855. //dmButtonSend.onclick = function() { alert('Hello world');}
  856. dmButtonSend.addEventListener('click', offOrOn);
  857. dmButtonSend.appendChild(btnStartText);
  858. if (btn) {
  859. copyAttributes(btn, dmButtonSend);
  860. const span = btn.querySelector('span');
  861. if (span) {
  862. copyAttributes(span, btnStartText);
  863. }
  864. }
  865. else {
  866. dmButtonSend.classList.add('danmu-btn');
  867. dmButtonSend.style.setProperty('--color', 'rgba(217,157,27,0.8)');
  868. }
  869. },
  870. btnStartLogin = () => {
  871. let iElement = document.createElement('i');
  872. iElement.classList.add('el-icon-s-promotion');
  873.  
  874. dmButtonSend = document.createElement('button');
  875. dmButtonSend.title = txtStartTask;
  876. dmButtonSend.classList.add('el-button');
  877. dmButtonSend.classList.add('el-button--mini');
  878. dmButtonSend.classList.add('is-circle');
  879. dmButtonSend.style.background = 'none';
  880. dmButtonSend.style.fontSize = '20px';
  881. dmButtonSend.style.border = '0';
  882. dmButtonSend.addEventListener('click', offOrOn);
  883. dmButtonSend.appendChild(iElement);
  884.  
  885. let div = document.createElement('div');
  886. div.style.position = 'absolute';
  887. div.style.right = '5px';
  888. div.style.alignSelf = 'flex-end';
  889. div.style.marginBottom = '-2px';
  890. div.appendChild(dmButtonSend);
  891. return div;
  892. },
  893. btnSetting = () => {
  894. const divEmo = document.getElementsByClassName('emoticons-panel border-box')[0]; // 表情包
  895. let iElement = document.createElement('i');
  896. iElement.classList.add('el-icon-setting');
  897.  
  898. let btn = document.createElement('button');
  899. btn.title = '定时设置';
  900. btn.classList.add('el-button');
  901. btn.classList.add('el-button--mini');
  902. btn.classList.add('is-circle');
  903. btn.style.background = 'none';
  904. btn.style.fontSize = '19px';
  905. btn.style.border = '0';
  906. btn.addEventListener('click', openSetting);
  907. btn.appendChild(iElement);
  908. if (divEmo) {
  909. let div = document.createElement('div');
  910. copyAttributes(divEmo, div);
  911. div.style.backgroundImage = 'none';
  912. div.style.alignSelf = 'flex-end';
  913. div.style.marginBottom = '5px';
  914. div.style.position = 'absolute';
  915. div.style.right = '33px';
  916. div.appendChild(btn);
  917.  
  918. divEmo.style.alignSelf = 'flex-start';
  919. divEmo.style.marginTop = '1px';
  920. return div;
  921. }
  922. else {
  923. btn.style.margin = '0 5px';
  924. return btn;
  925. }
  926. },
  927. copyAttributes = (oldNode, newNode) => {
  928. Array.prototype.forEach.call(oldNode.attributes, (item, index) => newNode.setAttribute(item.name, item.value));
  929. },
  930. setDisplay = (dom, property, important) => {
  931. if (important) {
  932. dom.style.setProperty('display', property, 'important');
  933. }
  934. else {
  935. dom.style.setProperty('display', property);
  936. }
  937. },
  938. blockDisplay = (dom, shwon) => {
  939. if (shwon) {
  940. setDisplay(dom, 'block', true);
  941. }
  942. else {
  943. dom.style.removeProperty('display');
  944. }
  945. },
  946. noneDisplay = (dom, hidden) => {
  947. if (hidden) {
  948. setDisplay(dom, 'none', true);
  949. }
  950. else {
  951. dom.style.removeProperty('display');
  952. }
  953. },
  954. removeAttributeFromChildren = (dom, attr) => {
  955. dom.removeAttribute(attr);
  956. if (0 < dom.children.length) {
  957. for (let i = 0; i < dom.children.length; i++) {
  958. removeAttributeFromChildren(dom.children[i], attr);
  959. }
  960. }
  961. },
  962. setAttributeToChildren = (dom, attr, val) => {
  963. dom.setAttribute(attr, val);
  964. if (0 < dom.children.length) {
  965. for (let i = 0; i < dom.children.length; i++) {
  966. setAttributeToChildren(dom.children[i], attr, val);
  967. }
  968. }
  969. },
  970. hideLoginGuideFunc = () => {
  971. let dom = document.getElementById('switch-login-guide-vm');
  972. if (dom) {
  973. noneDisplay(dom, hideLoginGuideCheckbox.checked);
  974. }
  975. },
  976. hideHarunaFunc = () => {
  977. let dom = document.getElementById('my-dear-haruna-vm');
  978. if (dom) {
  979. noneDisplay(dom, hideHarunaCheckbox.checked);
  980. }
  981. },
  982. hideShopFunc = () => {
  983. let dom = document.getElementById('shop-popover-vm');
  984. if (dom) {
  985. noneDisplay(dom, hideShopCheckbox.checked);
  986. }
  987. },
  988. hideGiftControlFunc = () => {
  989. let dom = document.getElementsByClassName('gift-control-section')[0];
  990. if (dom) {
  991. noneDisplay(dom, hideGiftControlCheckbox.checked);
  992. }
  993.  
  994. dom = document.getElementById('web-player__bottom-bar__container');
  995. if (dom) {
  996. noneDisplay(dom, hideGiftControlCheckbox.checked);
  997. }
  998.  
  999. dom = document.getElementsByTagName('video');
  1000. for (let i = 0; i < dom.length; i++) {
  1001. if (!dom[i]) {
  1002. return;
  1003. }
  1004. if (hideGiftControlCheckbox.checked) {
  1005. dom[i].style.setProperty('height', '100%');
  1006. }
  1007. else if (document.body.classList.contains('player-full-win') || document.body.classList.contains('fullscreen-fix')) {
  1008. dom[i].style.setProperty('height', 'calc(100% - 114px)');
  1009. }
  1010. }
  1011. },
  1012. hideRoomFeedFunc = () => {
  1013. let dom = document.getElementsByClassName('room-feed')[0];
  1014. if (dom) {
  1015. noneDisplay(dom, hideRoomFeedCheckbox.checked);
  1016. }
  1017. dom = document.getElementsByClassName('flip-view p-relative')[0];
  1018. if (dom) {
  1019. noneDisplay(dom, hideRoomFeedCheckbox.checked);
  1020. }
  1021. },
  1022. hideRoomInfoFunc = () => {
  1023. let dom = document.getElementsByClassName('room-info-ctnr')[0];
  1024. if (dom) {
  1025. noneDisplay(dom, hideRoomInfoCheckbox.checked);
  1026. }
  1027. },
  1028. hideNoticeFunc = () => {
  1029. let dom = document.getElementsByClassName('right-container')[0];
  1030. if (dom) {
  1031. dom.style.setProperty('min-height', 'auto');
  1032. noneDisplay(dom, hideNoticeCheckbox.checked);
  1033. }
  1034. },
  1035. hideFooterFunc = () => {
  1036. let dom = document.getElementById('link-footer-vm');
  1037. if (dom) {
  1038. noneDisplay(dom, hideFooterCheckbox.checked);
  1039. }
  1040. },
  1041. hidePrivacyFunc = () => {
  1042. if (hidePrivacyCheckbox.checked) {
  1043. let dom = document.createElement('style');
  1044. dom.id = 'hidePrivacyDialog';
  1045. dom.setAttribute('type', 'text/css');
  1046. dom.innerHTML = '.privacy-dialog{display:none !important;}';
  1047. document.head.appendChild(dom);
  1048. }
  1049. else {
  1050. let dom = document.getElementById('hidePrivacyDialog');
  1051. if (dom) {
  1052. dom.remove();
  1053. }
  1054. }
  1055. },
  1056. hideRoomStatusFunc = () => {
  1057. let dom = document.getElementsByClassName('web-player-icon-roomStatus')[0];
  1058. if (dom) {
  1059. noneDisplay(dom, hideRoomStatusCheckbox.checked);
  1060. }
  1061. },
  1062. hideBusinessFunc = () => {
  1063. let dom = document.getElementById('businessContainerElement');
  1064. if (dom) {
  1065. noneDisplay(dom, hideBusinessCheckbox.checked);
  1066. }
  1067. },
  1068. // 适配Bilibili直播自动追帧样式
  1069. adaptBililiveSeeker = () => {
  1070. let dom = document.getElementById('playback-rate-title');
  1071. if (dom) {
  1072. noneDisplay(dom, true);
  1073. dom.parentElement.style.removeProperty('padding-bottom');
  1074. }
  1075.  
  1076. dom = document.getElementById('playback-rate-username');
  1077. if (dom) {
  1078. dom.style.removeProperty('display');
  1079. }
  1080. },
  1081. hideRankListFunc = () => {
  1082. let lower = document.getElementsByClassName('lower-row')[0];
  1083. if (!lower) {
  1084. return;
  1085. }
  1086.  
  1087. let dom = lower.getElementsByClassName('right-ctnr')[0]
  1088. if (dom) {
  1089. noneDisplay(dom, hideRankListCheckbox.checked);
  1090. let t = workerTimer.setTimeout(() => {
  1091. workerTimer.clearTimeout(t);
  1092. t = null;
  1093. adaptBililiveSeeker();
  1094. }, 100);
  1095. }
  1096. },
  1097. showLiveAreaFunc = () => {
  1098. let dom = document.getElementsByClassName('live-area')[0];
  1099. if (dom) {
  1100. blockDisplay(dom, showLiveAreaCheckbox.checked);
  1101. adaptBililiveSeeker();
  1102. }
  1103. },
  1104. lotteryFunc = () => {
  1105. window.localStorage.setItem(lotteryChecked, lotteryCheckbox.checked);
  1106. let dom = document.getElementById('hesitationCheckboxDiv');
  1107. if (dom) {
  1108. noneDisplay(dom, !lotteryCheckbox.checked)
  1109. }
  1110. },
  1111. closeLotteryFunc = () => {
  1112. window.localStorage.setItem(closeLotteryChecked, closeLotteryCheckbox.checked);
  1113. },
  1114. hesitationFunc = () => {
  1115. window.localStorage.setItem(hesitationChecked, hesitationCheckbox.checked);
  1116. window.localStorage.setItem(hesitationExpiry, hesitateInput.value);
  1117. },
  1118. setPublicFunc = () => {},
  1119. usePublicFunc = () => {
  1120. let obj = null;
  1121. if (usePublicCheckbox.checked) {
  1122. obj = getGmValue(baseInfo.default, null);
  1123. }
  1124. else {
  1125. obj = source;
  1126. }
  1127. if (obj) {
  1128. setSource(obj);
  1129. }
  1130. },
  1131. clickLikeBtn = () => {
  1132. let dom = document.getElementsByClassName('like-btn')[0];
  1133. if (dom) {
  1134. dom.click();
  1135. // console.log(`===> 【${new Date().toLocaleString()}】点击一次点赞按钮`);
  1136. }
  1137. },
  1138. autoLikeFunc = () => {
  1139. if (autoLikeCheckbox.checked) {
  1140. if (autoLikeTimer) {
  1141. return;
  1142. }
  1143.  
  1144. clickLikeBtn();
  1145. // console.log(`===> 开启自动点赞功能【${new Date().toLocaleString()}】`);
  1146. autoLikeTimer = workerTimer.setInterval(() => {
  1147. let rdTimeout = Math.floor(Math.random() * 15000);
  1148. if (1000 > rdTimeout) {
  1149. // console.log(`===> 【${new Date().toLocaleString()}】立刻点击点赞按钮`);
  1150. clickLikeBtn();
  1151. }
  1152. else {
  1153. // console.log(`===> 【${new Date().toLocaleString()}】设置【${rdTimeout}】毫秒后点击点赞按钮`);
  1154. clickLikeBtnTimer = workerTimer.setTimeout(() => {
  1155. workerTimer.clearTimeout(clickLikeBtnTimer);
  1156. clickLikeBtnTimer = null;
  1157. clickLikeBtn();
  1158. }, rdTimeout);
  1159. }
  1160. }, 15e3);
  1161. }
  1162. else {
  1163. if (autoLikeTimer) {
  1164. workerTimer.clearInterval(autoLikeTimer);
  1165. autoLikeTimer = null;
  1166. // console.log(`===> 关闭自动点赞功能`);
  1167. }
  1168. if (clickLikeBtnTimer) {
  1169. workerTimer.clearTimeout(clickLikeBtnTimer);
  1170. clickLikeBtnTimer = null;
  1171. // console.log(`===> 关闭超时点击点赞按钮功能`);
  1172. }
  1173. }
  1174. },
  1175. clickPlay = () => {
  1176. // let dom = document.getElementsByClassName('_tip-btn_6f52f')[0];
  1177. // if (dom) {
  1178. // dom.click();
  1179. // }
  1180.  
  1181. // dom = document.getElementsByClassName('_tip-text_6f52f')[0];
  1182. // if (dom) {
  1183. // dom.click();
  1184. // }
  1185. },
  1186. autoPlay = () => {
  1187. let t = workerTimer.setTimeout(() => {
  1188. workerTimer.clearTimeout(t);
  1189. clickPlay();
  1190. t = workerTimer.setTimeout(() => {
  1191. workerTimer.clearTimeout(t);
  1192. t = null;
  1193. clickPlay();
  1194. }, 2e3);
  1195. }, 3e3);
  1196. },
  1197. noSleepFunc = () => {
  1198. if (noSleepCheckbox.checked) {
  1199. if (!noSleepTimer) {
  1200. console.log('===> 开启防休眠功能');
  1201. noSleepTimer = workerTimer.setInterval(() => {
  1202. noSleepTimeouter = workerTimer.setTimeout(() => {
  1203. workerTimer.clearTimeout(noSleepTimeouter);
  1204. document.body.dispatchEvent(new MouseEvent("mousemove", { bubbles: true }));
  1205. }, Math.random() * 3e3);
  1206. }, 17e3);
  1207. }
  1208. } else {
  1209. console.log('===> 关闭防休眠功能');
  1210. if (noSleepTimer) {
  1211. workerTimer.clearInterval(noSleepTimer);
  1212. noSleepTimer = null;
  1213. }
  1214. if (noSleepTimeouter) {
  1215. workerTimer.clearTimeout(noSleepTimeouter);
  1216. noSleepTimeouter = null;
  1217. }
  1218. }
  1219. },
  1220. biliMiniClose = () => {
  1221. if (!miniCloseTimer) {
  1222. let miniCloseCount = 3;
  1223. miniCloseTimer = workerTimer.setInterval(() => {
  1224. let mini_close = document.getElementsByClassName('bili-mini-close')[0];
  1225. if (!mini_close) {
  1226. if (0 >= --miniCloseCount) {
  1227. workerTimer.clearInterval(miniCloseTimer);
  1228. miniCloseTimer = null;
  1229. }
  1230.  
  1231. return;
  1232. }
  1233.  
  1234. mini_close.click();
  1235. workerTimer.clearInterval(miniCloseTimer);
  1236. miniCloseTimer = null;
  1237. }, 10e3);
  1238. }
  1239. },
  1240. closeLottery = delay => {
  1241. let btnClose = document.getElementsByClassName('close-btn bg-contain')[0];
  1242. if (btnClose) {
  1243. if (isNull(delay)) {
  1244. btnClose.click();
  1245. } else {
  1246. closeLotteryTimer = workerTimer.setTimeout(() => {
  1247. workerTimer.clearTimeout(closeLotteryTimer);
  1248. btnClose.click();
  1249. }, delay * 1000);
  1250. }
  1251. }
  1252. },
  1253. lottery = btn => {
  1254. if (!btn) {
  1255. console.warn('===> 没有抽奖按钮DOM');
  1256. return;
  1257. }
  1258. if ('false' === window.localStorage.getItem(lotteryChecked)) {
  1259. if ('true' === window.localStorage.getItem(closeLotteryChecked)) {
  1260. console.log('===> 不参与天选时刻抽奖,关闭弹窗');
  1261. closeLottery();
  1262. }
  1263.  
  1264. return;
  1265. }
  1266. if ('true' === window.localStorage.getItem(hesitationChecked)) {
  1267. let expiry = window.localStorage.getItem(hesitationExpiry);
  1268. expiry = isNull(expiry) || 0 >= expiry ? 10e4 : expiry * 1000;
  1269. expiry = Math.ceil(Math.random() * expiry);
  1270. // console.log(`===> 【${new Date().toLocaleString()}】随机时间【${expiry}】`);
  1271. let lotteryTimer = workerTimer.setTimeout(() => {
  1272. workerTimer.clearTimeout(lotteryTimer);
  1273. console.log(`===> ${new Date().toLocaleString()}】犹豫期过后自动参加抽奖`);
  1274. btn.click();
  1275. if ('true' === window.localStorage.getItem(closeLotteryChecked)) {
  1276. console.log('===> 参加成功,延迟关闭弹窗');
  1277. closeLottery(3);
  1278. }
  1279. }, expiry);
  1280. } else {
  1281. console.log('===> 立刻自动参加抽奖');
  1282. btn.click();
  1283. if ('true' === window.localStorage.getItem(closeLotteryChecked)) {
  1284. console.log('===> 参加成功,延迟关闭弹窗');
  1285. closeLottery(3);
  1286. }
  1287. }
  1288. },
  1289. listPlus = nodes => {
  1290. if (!nodes || 0 >= nodes.length) return;
  1291. Array.prototype.forEach.call(nodes, y => {
  1292. let aNode = y.firstChild;
  1293. if (!aNode) return;
  1294. let a_d2 = aNode.children[1];
  1295. if (!a_d2) return;
  1296. let a_d2_d2 = a_d2.children[1];
  1297. if (!a_d2_d2) return;
  1298. let a_d2_d2_d2 = a_d2_d2.children[1];
  1299. if (!a_d2_d2_d2) return;
  1300. let a_d2_d2_d2_d1 = a_d2_d2_d2.children[0];
  1301. if (!a_d2_d2_d2_d1) return;
  1302. aNode.title = a_d2_d2_d2_d1.textContent;
  1303. let a_d2_d1 = a_d2.children[0];
  1304. if (a_d2_d1) {
  1305. let a_d2_d1_last = a_d2_d1.lastChild;
  1306. if (a_d2_d1_last && a_d2_d1_last.style.display && 'none' == a_d2_d1_last.style.display) {
  1307. a_d2_d1_last.remove();
  1308. }
  1309. }
  1310. });
  1311. },
  1312. getConfig = () => {
  1313. let c = {};
  1314. if (baseInfo.config) {
  1315. c = getGmValue(baseInfo.config, {});
  1316. if (isNull(c.lottery)) {
  1317. c.lottery = false;
  1318. }
  1319. if (isNull(c.closeLottery)) {
  1320. c.closeLottery = false;
  1321. }
  1322. if (isNull(c.hesitation)) {
  1323. c.hesitation = false;
  1324. }
  1325. }
  1326.  
  1327. return c;
  1328. },
  1329. checkVersion = () => {
  1330. config = getConfig();
  1331. if (!config || !config.moduleVersion || !divUpdateInfo) {
  1332. return;
  1333. }
  1334. if (0 < compareVersion(config.moduleVersion, version)) {
  1335. divUpdateInfo.innerHTML = `<span class="update-info-text">有新版本,刷新网页进行更新</span>`;
  1336. let dom = document.getElementById('otherContainer');
  1337. if (dom) {
  1338. dom.style.fontSize = '18px';
  1339. dom.style.textAlign = 'center';
  1340. dom.appendChild(divUpdateInfo.cloneNode(true));
  1341. }
  1342. }
  1343. },
  1344. loadData = () => {
  1345. let obj = getGmValue(roomId, null),
  1346. key = roomId;
  1347. if (obj) {
  1348. if (obj.usePublic && baseInfo.default) {
  1349. let ps = getGmValue(baseInfo.default, null);
  1350. if (ps) {
  1351. obj.data1.values = ps.data1 ? ps.data1.values : obj.data1.values;
  1352. obj.data2.values = ps.data2 ? ps.data2.values : obj.data2.values;
  1353. obj.data3.values = ps.data3 ? ps.data3.values : obj.data3.values;
  1354. obj.data4.values = ps.data4 ? ps.data4.values : obj.data4.values;
  1355. obj.data5.values = ps.data5 ? ps.data5.values : obj.data5.values;
  1356. }
  1357. }
  1358. if (source.version === obj.version) {
  1359. source = {...source, ...obj};
  1360. }
  1361. else if (obj.version === 2) {
  1362. source.data1 = obj.data1;
  1363. source.data2 = obj.data2;
  1364. source.data3 = obj.data3;
  1365. source.data4 = obj.data4;
  1366. source.data5 = obj.data5;
  1367. setGmValue(key, source);
  1368. }
  1369. else {
  1370. source.data1.values = obj.data1 ? obj.data1.values : source.data1.values;
  1371. source.data2.values = obj.data2 ? obj.data2.values : source.data2.values;
  1372. source.data3.values = obj.data3 ? obj.data3.values : source.data3.values;
  1373. source.data4.values = obj.data4 ? obj.data4.values : source.data4.values;
  1374. source.data5.values = obj.data5 ? obj.data5.values : source.data5.values;
  1375. setGmValue(key, source);
  1376. }
  1377. }
  1378. config = getConfig();
  1379. signInput.value = isNull(config.signInText) ? '' : config.signInText;
  1380. hesitateInput.value = isNull(config.hesitationExpiry) ? '100' : config.hesitationExpiry;
  1381. setSource(source);
  1382. setOperationSetting();
  1383. initData();
  1384. },
  1385. initSettingPanel = (div, isLogin) => {
  1386. let settingPanel = document.getElementById('danmu-setting-panel');
  1387. if (div && !settingPanel) {
  1388. // console.log('===> 进行面板初始化');
  1389. buildPanel();
  1390. if (isLogin) {
  1391. let divBtn = document.getElementsByClassName('right-actions border-box')[0]; // 登录(不可用)的发送按钮
  1392. if (divBtn) {
  1393. divBtn.style.alignSelf = 'flex-start';
  1394. divBtn.style.marginTop = '5px';
  1395. div.appendChild(btnStartLogin());
  1396. div.insertBefore(btnSetting(), divBtn);
  1397. }
  1398. }
  1399. else {
  1400. let btnSend = document.getElementsByClassName('bl-button--primary bl-button--small')[0];
  1401. if (btnSend) {
  1402. btnStart(btnSend);
  1403. let funcDiv = document.createElement('div');
  1404. funcDiv.style.position = 'absolute';
  1405. funcDiv.appendChild(dmButtonSend);
  1406. funcDiv.appendChild(btnSetting());
  1407. div.appendChild(funcDiv);
  1408. // bgcolor = window.getComputedStyle(btnSend).getPropertyValue('background-color');
  1409. // dmButtonSend.style.setProperty('background', bgcolor);
  1410. // dmButtonSend.style.setProperty('--color', bgcolor.replace(')', ', 0.8)'));
  1411. } else {
  1412. console.warn('===> 发送按钮丢失');
  1413. return false;
  1414. }
  1415. }
  1416. loadData();
  1417. // console.log('===> 面板初始化完成');
  1418. }
  1419.  
  1420. return true;
  1421. },
  1422. main = (div, isLogin) => {
  1423. waiters[waiters.length] = workerTimer.setInterval(() => {
  1424. if (initSettingPanel(div, isLogin)) {
  1425. clearWaiters();
  1426. } else {
  1427. --waitCount;
  1428. if (0 >= waitCount) {
  1429. clearWaiters();
  1430. console.log('===> 创建面板失败,停止初始化');
  1431. }
  1432. }
  1433. }, 1.5e3);
  1434. },
  1435. PluginBtn = (clazz, isLogin) => {
  1436. let div = document.getElementsByClassName(clazz)[0];
  1437. if (div) {
  1438. main(div, isLogin);
  1439. } else {
  1440. let count = 0;
  1441. divSendBtnTimer = workerTimer.setInterval(() => {
  1442. div = document.getElementsByClassName(clazz)[0];
  1443. if (div) {
  1444. workerTimer.clearInterval(divSendBtnTimer);
  1445. main(div, isLogin);
  1446. } else if (count++ >= 10) {
  1447. workerTimer.clearInterval(divSendBtnTimer);
  1448. // console.log(`===> 页面【${window.location.href}】没有定位位置`);
  1449. }
  1450. }, 1e3);
  1451. }
  1452. },
  1453. PluginLogout = () => PluginBtn('bottom-actions p-relative', false),
  1454. PluginLogin = () => PluginBtn('chat-input-ctnr-new p-relative default-height', true),
  1455. PluginLottery = () => {
  1456. let btn = document.getElementsByClassName('particitation-btn')[0];
  1457. if (btn) {
  1458. lottery(btn);
  1459. } else {
  1460. btnLotteryTimer = workerTimer.setTimeout(() => {
  1461. workerTimer.clearTimeout(btnLotteryTimer);
  1462. btn = document.getElementsByClassName('particitation-btn')[0];
  1463. if (btn) {
  1464. lottery(btn);
  1465. }
  1466. }, 2e3);
  1467. }
  1468. },
  1469. PluginListPlus = () => {
  1470. let listTimer = workerTimer.setTimeout(() => {
  1471. workerTimer.clearTimeout(listTimer);
  1472. let obsConfig = {childList: true},
  1473. tags = ['all__card-list-ctnr', 'all__special-area-recommend-list-ctnr'];
  1474. tags.forEach(x => {
  1475. let dom = document.getElementsByClassName(x)[0];
  1476. if (!dom) return;
  1477. Array.prototype.forEach.call(dom.children, y => {
  1478. if (/^index_/i.test(y.className)) {
  1479. listPlus(y.children);
  1480. let obs = new MutationObserver(mrs => {
  1481. if (!mrs || 0 >= mrs.length) return;
  1482. Array.prototype.forEach.call(mrs, z => listPlus(z.addedNodes));
  1483. });
  1484. obs.observe(y, obsConfig);
  1485. }
  1486. });
  1487. });
  1488. }, 0.5e3);
  1489. },
  1490. // debug = () => {debugger;},
  1491. runStart = () => {
  1492. PluginLottery();
  1493. PluginListPlus();
  1494. PluginLogout();
  1495. PluginLogin();
  1496. };
  1497.  
  1498. initCss();
  1499. // initScript();
  1500. // window.debug = debug;
  1501. window.runStart = runStart;
  1502. window.arrayInfo = arrayInfo;
  1503. window.setGmNotice = setGmNotice;
  1504. window.setGmGetValue = setGmGetValue;
  1505. window.setGmSetValue = setGmSetValue;
  1506. window.setGmDelValue = setGmDelValue;
  1507. window.setBaseInfo = setBaseInfo;
  1508. window.checkVersion = checkVersion;
  1509. })();

QingJ © 2025

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