b-live-random-send-诗词

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

目前為 2022-07-24 提交的版本,檢視 最新版本

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

  1. // ==UserScript==
  2. // @name b-live-random-send-诗词
  3. // @description 定时从设置的字幕中随机取出一条在B站直播间发送,需先登录B站账号
  4. // @author Gamyou
  5. // @version 1.2.4
  6. // @note 22-07-23 1.2.4 修复弹幕分组数据都为空时,旧数据重复合并的BUG
  7. // @note 22-07-16 1.2.3 修复设置弹幕时旧(初始)数据没有清空的BUG
  8. // @note 22-06-24 1.2.2 优化部分代码
  9. // @note 22-06-20 1.2.1 修复定时停止不能再开始的BUG
  10. // @note 22-06-19 1.2.0 添加弹幕设置功能
  11. // ==/UserScript==
  12.  
  13.  
  14. (function () {
  15. window.autoSendDanmuModuleLoaded = false;
  16. let source = {
  17. version: 2,
  18. data1: { available: true, values: ['绿豆', '红豆', '黄豆', '蓝猫'] },
  19. data2: { available: true, values: ['红', '接天莲叶无穷碧,映日荷花别样红。'] },
  20. data3: { available: true, values: ['黄', '儿童急走追黄蝶,飞入菜花无处寻。'] },
  21. data4: { available: true, values: ['蓝', '沧海月明珠有泪,蓝田日暖玉生烟。'] },
  22. data5: { available: true, values: ['绿', '惟有绿荷红菡萏,卷舒开合任天真。'] }
  23. };
  24. let waiters = [], data = [], timer = null, signInContent = '签到';
  25. let storeDataCallback = (obj) => { }, removeDataCallback = (obj) => { };
  26. let count = 0, lastSent = 0, arrayIndex = 0, isRandom = true, default_timeout = 600;
  27. let dmButtonSend, dmInput, divSetting, dataText1, dataText2, dataText3, dataText4, dataText5, spanApplyTip, rdCheckbox;
  28. const waitCount = 10,
  29. initCss = () => {
  30. let linkElement = document.createElement('link');
  31. linkElement.rel = 'stylesheet';
  32. linkElement.href = 'https://unpkg.com/element-ui@2.15.9/lib/theme-chalk/index.css';
  33. document.head.appendChild(linkElement);
  34.  
  35. // 图标库 https://ionic.io/ionicons
  36. // let scriptElement = document.createElement('script');
  37. // scriptElement.src = 'https://unpkg.com/ionicons@5.5.2/dist/ionicons.js';
  38. // document.head.appendChild(scriptElement);
  39.  
  40. let customerStyle = document.createElement('style');
  41. customerStyle.setAttribute('type', 'text/css');
  42. customerStyle.innerHTML = '.danmu_group_title{font-size:14px;padding-left:2px;color:rgb(18, 56, 141);}.danmu_group_textarea{width:98%;min-height:100px;height:20%;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;}.random-check{display:inline-block;}.random-check label{display:inline-block;vertical-align:middle;border:1px solid #bdc3c7;border-radius:60px;width:40px;height:18px;position:relative;transition:all .3s;}.random-check input{display:none;}.random-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;}.random-check :checked ~ label{background-color:#26b22b;border-color:#26b22b;}.random-check :checked ~ label:before{left:22px;background-color:#fff;}';
  43. document.head.appendChild(customerStyle);
  44. },
  45. getCurrentTimestamp = () => new Date().getTime(),
  46. send = (msg, index) => {
  47. let dmTextArea = document.getElementById('aside-area-vm').getElementsByClassName('chat-input border-box')[0];
  48. if (!dmTextArea) {
  49. alert('找不到输入弹幕文本框,请尝试刷新页面');
  50. return;
  51. }
  52.  
  53. let btnSend = document.getElementsByClassName('bl-button live-skin-highlight-button-bg live-skin-button-text bl-button--primary bl-button--small')[0];
  54. if (!btnSend) {
  55. alert('找不到发送按钮,请尝试刷新页面');
  56. return;
  57. }
  58. // if (getCurrentTimestamp() - lastSent < 5000) {
  59. // setTimeout(() => send(msg, index), 5000);
  60. // console.log('++++++++++++++++++++++> 发送间隔少于5秒,进入递归处理 <++++++++++++++++++++++');
  61. // } else {
  62. dmTextArea.value = msg;
  63. // 定义事件, 定义才可发送
  64. dmTextArea.dispatchEvent(new Event('input', { "bubbles": true, "cancelable": true }));
  65. btnSend.click();
  66. lastSent = getCurrentTimestamp();
  67. ++count;
  68. console.log('=================> ' + new Date().toLocaleString() + ' 弹幕发送成功 ' + count + ' 次,第【' + index + '】条数据 === ' + msg);
  69. // }
  70. },
  71. isNull = (str) => {
  72. if (!str || str == "")
  73. return true;
  74.  
  75. let regu = "^[ ]+$";
  76. let re = new RegExp(regu);
  77. return re.test(str);
  78. },
  79. randomSort = (arr) => {
  80. for (let i = 0; i < arr.length; i++) {
  81. const rdIndex = Math.floor(Math.random() * arr.length);
  82. const temp = arr[i];
  83. arr[i] = arr[rdIndex];
  84. arr[rdIndex] = temp;
  85. }
  86.  
  87. return arr;
  88. },
  89. clearWaiters = () => {
  90. for (let i = 0; i < waiters.length; i++) {
  91. clearInterval(waiters[i]);
  92. waiters[i] = null;
  93. }
  94.  
  95. waiters = [];
  96. },
  97. signIn = () => {
  98. let timestamp = new Date(new Date(new Date().setDate(new Date().getDate() + 1)).toDateString()).getTime() - getCurrentTimestamp();
  99. console.log('=================> 设置第二天凌晨签到定时器【' + timestamp + '】');
  100. setTimeout(() => {
  101. send(signInContent, 0);
  102. console.log('++++++++++++++++++++++> 完成签到发送,进入下一轮递归签到发送 <++++++++++++++++++++++');
  103. signIn();
  104. }, timestamp);
  105. },
  106. // selectRandom = () => isRandom = rdCheckbox.checked,
  107. openSetting = () => divSetting.style.display = 'block',
  108. closeSetting = () => {
  109. rdCheckbox.checked = isRandom;
  110. divSetting.style.display = 'none';
  111. },
  112. initData = () => {
  113. if (source.data1.values.length <= 0
  114. && source.data2.values.length <= 0
  115. && source.data3.values.length <= 0
  116. && source.data4.values.length <= 0
  117. && source.data5.values.length <= 0) {
  118. return data ? data : [];
  119. }
  120.  
  121. let result = [];
  122. result = source.data1.available ? result.concat(source.data1.values) : result;
  123. result = source.data2.available ? result.concat(source.data2.values) : result;
  124. result = source.data3.available ? result.concat(source.data3.values) : result;
  125. result = source.data4.available ? result.concat(source.data4.values) : result;
  126. result = source.data5.available ? result.concat(source.data5.values) : result;
  127. data = result;
  128. !rdCheckbox || rdCheckbox.checked ? data = randomSort(result) : arrayIndex = 0;
  129. },
  130. applySetting = () => {
  131. source.data1.values = isNull(dataText1.value) ? [] : dataText1.value.split('|');
  132. source.data2.values = isNull(dataText2.value) ? [] : dataText2.value.split('|');
  133. source.data3.values = isNull(dataText3.value) ? [] : dataText3.value.split('|');
  134. source.data4.values = isNull(dataText4.value) ? [] : dataText4.value.split('|');
  135. source.data5.values = isNull(dataText5.value) ? [] : dataText5.value.split('|');
  136. initData();
  137. storeDataCallback(source);
  138. isRandom = rdCheckbox.checked;
  139. spanApplyTip.style.display = 'block';
  140. setTimeout(() => {
  141. spanApplyTip.style.display = 'none';
  142. }, 1500);
  143. },
  144. danmu = () => {
  145. if (data.length < 1) {
  146. alert('请任意在一个分组里输入一条弹幕');
  147. return;
  148. }
  149. if (isRandom)
  150. arrayIndex = Math.floor((Math.random() * data.length));
  151.  
  152. send(data[arrayIndex], arrayIndex);
  153. ++arrayIndex;
  154. if (arrayIndex >= data.length)
  155. arrayIndex = 0;
  156. },
  157. offOrOn = () => {
  158. let timeout = 0;
  159. if (timer) {
  160. console.log('=================> ' + new Date().toLocaleString() + ' 停止发送弹幕');
  161. clearInterval(timer);
  162. timer = null;
  163. console.log('=================> ' + new Date().toLocaleString() + ' 停止成功!!');
  164. dmButtonSend.style.background = 'rgba(217,157,27,1)';
  165. dmButtonSend.textContent = '开始';
  166. dmInput.removeAttribute("disabled");
  167. } else {
  168. timeout = isNull(dmInput.value) ? default_timeout * 1000 : dmInput.value * 1000;
  169. danmu();
  170. console.log('=================> ' + new Date().toLocaleString() + ' 开启定时器');
  171. timer = setInterval(danmu, timeout);
  172. console.log('=================> ' + new Date().toLocaleString() + ' 开启成功!!');
  173. dmButtonSend.style.background = '#ff0000';
  174. dmButtonSend.textContent = '停止';
  175. dmInput.setAttribute('disabled', 'disabled');
  176. }
  177. },
  178. pageFullyLoaded = () => {
  179. let divButton = document.getElementsByClassName('bottom-actions p-relative')[0];
  180. if (!divButton) {
  181. console.error('没能找到发送按钮上层的div');
  182. --waitCount;
  183. if (0 >= waitCount) {
  184. clearWaiters();
  185. }
  186. return;
  187. }
  188. clearWaiters();
  189.  
  190. /* ----------------------------------------- head ----------------------------------------- */
  191. let divSettingTitle = document.createElement('div');
  192. divSettingTitle.textContent = '弹幕设置';
  193. divSettingTitle.style.textAlign = 'center';
  194. divSettingTitle.style.fontSize = '16px';
  195. divSettingTitle.style.fontWeight = '700';
  196. divSettingTitle.style.color = '#1c5adc';
  197. divSettingTitle.style.lineHeight = '30px';
  198.  
  199. let divTip = document.createElement('div');
  200. divTip.style.color = '#0b81cc';
  201. divTip.style.textAlign = 'center';
  202. divTip.style.fontStyle = 'italic';
  203. divTip.style.height = '25px';
  204. divTip.innerHTML = '任一分组内输入弹幕即可,多条用<span style="color:#dc6b07;margin:0 2px 0 4px;font-weight:700;font-style:normal;">竖线</span>分隔';
  205. /* ----------------------------------------- head ----------------------------------------- */
  206.  
  207. /* ----------------------------------------- textarea ----------------------------------------- */
  208. let divText1 = document.createElement('div');
  209. divText1.textContent = '分组 1 :'
  210. // divText1.style.fontSize = '14px';
  211. // divText1.style.paddingLeft = '2px';
  212. // divText1.style.color = '#12388d';
  213. // divText1.style.display = 'inline';
  214. divText1.classList.add('danmu_group_title');
  215.  
  216. dataText1 = document.createElement('textarea');
  217. // dataText1.style.width = '98%';
  218. // dataText1.style.minHeight = '100px';
  219. // dataText1.style.height = '20%';
  220. // dataText1.style.margin = '1px 0 4px 0';
  221. // dataText1.style.border = '0';
  222. // dataText1.style.resize = 'none';
  223. dataText1.classList.add('danmu_group_textarea');
  224. dataText1.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  225.  
  226. let divText2 = document.createElement('div');
  227. divText2.textContent = '分组 2 :'
  228. // divText2.style.fontSize = '14px';
  229. // divText2.style.paddingLeft = '2px';
  230. // divText2.style.color = '#12388d';
  231. divText2.classList.add('danmu_group_title');
  232.  
  233. dataText2 = document.createElement('textarea');
  234. // dataText2.style.width = '98%';
  235. // dataText2.style.minHeight = '100px';
  236. // dataText2.style.height = '20%';
  237. // dataText2.style.margin = '1px 0 4px 0';
  238. // dataText2.style.border = '0';
  239. // dataText2.style.resize = 'none';
  240. dataText2.classList.add('danmu_group_textarea');
  241. dataText2.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  242.  
  243. let divText3 = document.createElement('div');
  244. divText3.textContent = '分组 3 :'
  245. // divText3.style.fontSize = '14px';
  246. // divText3.style.paddingLeft = '2px';
  247. // divText3.style.color = '#12388d';
  248. divText3.classList.add('danmu_group_title');
  249.  
  250. dataText3 = document.createElement('textarea');
  251. // dataText3.style.width = '98%';
  252. // dataText3.style.minHeight = '100px';
  253. // dataText3.style.height = '20%';
  254. // dataText3.style.margin = '1px 0 4px 0';
  255. // dataText3.style.border = '0';
  256. // dataText3.style.resize = 'none';
  257. dataText3.classList.add('danmu_group_textarea');
  258. dataText3.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  259.  
  260. let divText4 = document.createElement('div');
  261. divText4.textContent = '分组 4 :'
  262. // divText4.style.fontSize = '14px';
  263. // divText4.style.paddingLeft = '2px';
  264. // divText4.style.color = '#12388d';
  265. divText4.classList.add('danmu_group_title');
  266.  
  267. dataText4 = document.createElement('textarea');
  268. // dataText4.style.width = '98%';
  269. // dataText4.style.minHeight = '100px';
  270. // dataText4.style.height = '20%';
  271. // dataText4.style.margin = '1px 0 4px 0';
  272. // dataText4.style.border = '0';
  273. // dataText4.style.resize = 'none';
  274. dataText4.classList.add('danmu_group_textarea');
  275. dataText4.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  276.  
  277. let divText5 = document.createElement('div');
  278. divText5.textContent = '分组 5 :'
  279. // divText5.style.fontSize = '14px';
  280. // divText5.style.paddingLeft = '2px';
  281. // divText5.style.color = '#12388d';
  282. divText5.classList.add('danmu_group_title');
  283.  
  284. dataText5 = document.createElement('textarea');
  285. // dataText5.style.width = '98%';
  286. // dataText5.style.minHeight = '100px';
  287. // dataText5.style.height = '20%';
  288. // dataText5.style.margin = '1px 0 4px 0';
  289. // dataText5.style.border = '0';
  290. // dataText5.style.resize = 'none';
  291. dataText5.classList.add('danmu_group_textarea');
  292. dataText5.setAttribute('placeholder', '请输入弹幕,多条弹幕请用“|”分隔');
  293. /* ----------------------------------------- textarea ----------------------------------------- */
  294.  
  295. /* ----------------------------------------- random chackbox ----------------------------------------- */
  296. let descCheckbox = document.createElement('span');
  297. descCheckbox.textContent = '随机';
  298. descCheckbox.title = '将合并所有分组数据,从中随机选出一条发送';
  299. descCheckbox.style.fontSize = '16px';
  300. descCheckbox.style.verticalAlign = 'middle';
  301. descCheckbox.style.marginRight = '4px';
  302. descCheckbox.style.color = '#095ca2';
  303.  
  304. rdCheckbox = document.createElement('input');
  305. rdCheckbox.type = 'checkbox';
  306. rdCheckbox.id = 'rdmCheckbox';
  307. rdCheckbox.checked = isRandom;
  308. // rdCheckbox.addEventListener('click', selectRandom);
  309.  
  310. let lblCheckbox = document.createElement('label');
  311. lblCheckbox.setAttribute('for', 'rdmCheckbox');
  312.  
  313. let divCheckbox = document.createElement('div');
  314. divCheckbox.classList.add('random-check');
  315. divCheckbox.style.marginLeft = '10px';
  316. divCheckbox.appendChild(descCheckbox);
  317. divCheckbox.appendChild(rdCheckbox);
  318. divCheckbox.appendChild(lblCheckbox);
  319. /* ----------------------------------------- random chackbox ----------------------------------------- */
  320.  
  321. /* ----------------------------------------- div tip ----------------------------------------- */
  322. spanApplyTip = document.createElement('span');
  323. spanApplyTip.textContent = '设置成功'
  324. spanApplyTip.style.fontSize = '16px';
  325. spanApplyTip.style.color = '#128712';
  326. spanApplyTip.style.display = 'none';
  327.  
  328. let divApplyTip = document.createElement('div');
  329. divApplyTip.style.textAlign = 'center';
  330. divApplyTip.style.display = 'inline-block';
  331. divApplyTip.style.verticalAlign = 'middle';
  332. divApplyTip.style.width = '34%';
  333. divApplyTip.appendChild(spanApplyTip);
  334. /* ----------------------------------------- div tip ----------------------------------------- */
  335.  
  336. /* ----------------------------------------- appley and close button ----------------------------------------- */
  337. let btnApplySetting = document.createElement('i');
  338. btnApplySetting.setAttribute('title', '应用');
  339. btnApplySetting.classList.add('el-button');
  340. btnApplySetting.classList.add('el-icon-check');
  341. btnApplySetting.classList.add('is-circle');
  342. btnApplySetting.addEventListener('click', applySetting);
  343.  
  344. let btnCloseSetting = document.createElement('i');
  345. btnCloseSetting.setAttribute('title', '关闭');
  346. btnCloseSetting.classList.add('el-button');
  347. btnCloseSetting.classList.add('el-icon-close');
  348. btnCloseSetting.classList.add('is-circle');
  349. btnCloseSetting.addEventListener('click', closeSetting);
  350.  
  351. let divSettingButton = document.createElement('div');
  352. divSettingButton.style.display = 'inline-block';
  353. divSettingButton.style.verticalAlign = 'middle';
  354. divSettingButton.appendChild(btnApplySetting);
  355. divSettingButton.appendChild(btnCloseSetting);
  356. /* ----------------------------------------- appley and close button ----------------------------------------- */
  357.  
  358. /* ----------------------------------------- container ----------------------------------------- */
  359. let divBottomContainer = document.createElement('div');
  360. divBottomContainer.style.width = '100%';
  361. divBottomContainer.style.lineHeight = '35px';
  362. divBottomContainer.appendChild(divCheckbox);
  363. divBottomContainer.appendChild(divApplyTip);
  364. divBottomContainer.appendChild(divSettingButton);
  365.  
  366. let divContainer = document.createElement('div');
  367. divContainer.style.height = 'calc(98% - 30px - 25px)';
  368. divContainer.appendChild(divText1);
  369. divContainer.appendChild(dataText1);
  370. divContainer.appendChild(divText2);
  371. divContainer.appendChild(dataText2);
  372. divContainer.appendChild(divText3);
  373. divContainer.appendChild(dataText3);
  374. divContainer.appendChild(divText4);
  375. divContainer.appendChild(dataText4);
  376. divContainer.appendChild(divText5);
  377. divContainer.appendChild(dataText5);
  378. divContainer.appendChild(divBottomContainer);
  379. /* ----------------------------------------- container ----------------------------------------- */
  380.  
  381. divSetting = document.createElement('div');
  382. divSetting.style.backgroundColor = '#d4f2e0';
  383. divSetting.style.borderRadius = '2px';
  384. divSetting.style.width = '100%';
  385. divSetting.style.height = '100%';
  386. divSetting.style.overflowY = 'auto';
  387. divSetting.style.position = 'absolute';
  388. divSetting.style.left = '0';
  389. divSetting.style.top = '0';
  390. divSetting.style.zIndex = '999';
  391. divSetting.style.display = 'none';
  392. divSetting.appendChild(divSettingTitle);
  393. divSetting.appendChild(divTip);
  394. divSetting.appendChild(divContainer);
  395.  
  396. let asideAreaVm = document.getElementById('aside-area-vm');
  397. asideAreaVm.appendChild(divSetting);
  398.  
  399. /* ----------------------------------------- function ----------------------------------------- */
  400. dmButtonSend = document.createElement('button');
  401. dmButtonSend.textContent = '开始';
  402. dmButtonSend.style.minWidth = '65px';
  403. dmButtonSend.style.height = '24px';
  404. dmButtonSend.style.fontSize = '12px';
  405. dmButtonSend.style.borderRadius = '4px';
  406. dmButtonSend.style.color = '#ffffff';
  407. dmButtonSend.style.background = 'rgba(217,157,27,1)';
  408. dmButtonSend.style.border = '0';
  409. dmButtonSend.style.cursor = 'pointer';
  410. //dmButtonSend.onclick = function() { alert('Hello world');}
  411. dmButtonSend.addEventListener('click', offOrOn);
  412.  
  413. let beforeSpan = document.createElement('span');
  414. beforeSpan.textContent = '每';
  415. beforeSpan.style.color = '#ffffff';
  416. beforeSpan.style.fontSize = '12px';
  417. beforeSpan.style.marginLeft = '4px';
  418. beforeSpan.style.backgroundColor = '#ec6c1b';
  419.  
  420. dmInput = document.createElement('input');
  421. dmInput.value = default_timeout;
  422. dmInput.style.width = '25px';
  423. dmInput.style.height = '15px';
  424. dmInput.style.margin = '0 3px';
  425. dmInput.style.border = '0';
  426. dmInput.style.borderRadius = '3px';
  427. dmInput.setAttribute('oninput', "this.value = this.value.replace(/[^0-9]/g, '')");
  428.  
  429. let afterSpan = document.createElement('span');
  430. afterSpan.textContent = '秒发送';
  431. afterSpan.style.color = '#ffffff';
  432. afterSpan.style.fontSize = '12px';
  433. afterSpan.style.backgroundColor = '#ec6c1b';
  434. afterSpan.style.marginRight = '4px';
  435.  
  436. let iElement = document.createElement('i');
  437. iElement.classList.add('el-icon-setting');
  438.  
  439. let btnSetting = document.createElement('button');
  440. btnSetting.title = '设置';
  441. btnSetting.classList.add('el-button');
  442. btnSetting.classList.add('el-button--mini');
  443. btnSetting.classList.add('is-circle');
  444. btnSetting.addEventListener('click', openSetting);
  445. btnSetting.appendChild(iElement);
  446.  
  447. // let btnSetting = document.createElement('ion-icon');
  448. // btnSetting.setAttribute('name', 'settings-sharp');
  449. // btnSetting.classList.add('el-button');
  450. // btnSetting.classList.add('el-button--mini');
  451. // btnSetting.classList.add('is-circle');
  452. // btnSetting.addEventListener('click', openSetting);
  453.  
  454. let div = document.createElement('div');
  455. div.style.position = 'absolute';
  456. div.appendChild(dmButtonSend);
  457. div.appendChild(beforeSpan);
  458. div.appendChild(dmInput);
  459. div.appendChild(afterSpan);
  460. div.appendChild(btnSetting);
  461. divButton.appendChild(div);
  462. /* ----------------------------------------- function ----------------------------------------- */
  463.  
  464. window.autoSendDanmuModuleLoaded = true;
  465. },
  466. arrayInfo = () => console.info(data),
  467. setDanmuData = (obj) => {
  468. if (obj) {
  469. if (source.version === obj.version)
  470. source = obj;
  471. else {
  472. source.data1.values = obj.data1 ? obj.data1 : source.data1.values;
  473. source.data2.values = obj.data2 ? obj.data2 : source.data2.values;
  474. source.data3.values = obj.data3 ? obj.data3 : source.data3.values;
  475. source.data4.values = obj.data4 ? obj.data4 : source.data4.values;
  476. source.data5.values = obj.data5 ? obj.data5 : source.data5.values;
  477. storeDataCallback(source);
  478. }
  479. }
  480.  
  481. dataText1.value = source.data1.values.join('|');
  482. dataText2.value = source.data2.values.join('|');
  483. dataText3.value = source.data3.values.join('|');
  484. dataText4.value = source.data4.values.join('|');
  485. dataText5.value = source.data5.values.join('|');
  486. initData();
  487. },
  488. storeDanmuData = (cb) => storeDataCallback = cb,
  489. removeDanmuData = (cb) => removeDataCallback = cb;
  490.  
  491. initCss();
  492. window.addEventListener("load", () => {
  493. waiters[waiters.length] = setInterval(pageFullyLoaded, 1500);
  494. window.arrayInfo = arrayInfo;
  495. window.setDanmuData = setDanmuData;
  496. window.storeDanmuData = storeDanmuData;
  497. window.removeDanmuData = removeDanmuData;
  498. signIn();
  499. });
  500. })();