b-live-random-send-test

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

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

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

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