Flow Youtube Chat

Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)

当前为 2021-02-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.13.8
  4. // @description Youtubeのチャットをニコニコ風に画面上へ流すスクリプトです(再アップ,絵文字バグ修正済み)
  5. // @match https://www.youtube.com/*
  6. // @namespace FlowYoutubeChatScript
  7. // @run-at document-end
  8. // @grant GM.setValue
  9. // @grant GM.getValue
  10. // @grant GM.deleteValue
  11. // @grant GM.listValues
  12. // @noframes
  13. // @license AGPL-3.0-or-later
  14. // @require https://cdn.jsdelivr.net/npm/sweetalert2@10.10.1/dist/sweetalert2.all.min.js#sha384-OCBhaEdUu7BFgaeRVey2PDeHof2MSQRFe/e6S8Q3XrmSV7wrKpLmhPj8FOldGiaF
  15. // @require https://unpkg.com/loglevel@1.7.0/dist/loglevel.min.js#sha384-7gGuWfek8Ql6j/uNDFrS0BCe4x2ZihD4B68w9Eu580OVHJBV+bl3rZmEWC7q5/Gj
  16. // @require https://unpkg.com/rxjs@7.0.0-beta.10/dist/bundles/rxjs.umd.min.js#sha384-+BwV2u+ZJFwj586/3PlpsZdYS1U/+hT/zpjYSznHH4XzUJqgshDzZITJ+zGeWl//
  17. // @require https://unpkg.com/mithril@2.0.4/mithril.min.js#sha384-vo9crXih40MlEv6JWHqS7SsPiFp+76csaWQFOF2UU0/xI58Jm/ZvK/1UtpaicJT9
  18. // ==/UserScript==
  19.  
  20. /* jshint esversion: 6 */
  21.  
  22. ;(() => {
  23. var __webpack_modules__ = {
  24. 494: function (module, exports, __webpack_require__) {
  25. var __WEBPACK_AMD_DEFINE_RESULT__
  26. !(function (globals) {
  27. "use strict"
  28. var messages,
  29. predicates,
  30. functions,
  31. assert,
  32. not,
  33. maybe,
  34. collections,
  35. hasOwnProperty,
  36. toString,
  37. keys,
  38. slice,
  39. isArray,
  40. neginf,
  41. posinf,
  42. haveSymbols,
  43. haveMaps,
  44. haveSets
  45. function assigned(data) {
  46. return null != data
  47. }
  48. function number(data) {
  49. return "number" == typeof data && data > neginf && data < posinf
  50. }
  51. function integer(data) {
  52. return "number" == typeof data && data % 1 == 0
  53. }
  54. function greater(lhs, rhs) {
  55. return number(lhs) && lhs > rhs
  56. }
  57. function less(lhs, rhs) {
  58. return number(lhs) && lhs < rhs
  59. }
  60. function greaterOrEqual(lhs, rhs) {
  61. return number(lhs) && lhs >= rhs
  62. }
  63. function lessOrEqual(lhs, rhs) {
  64. return number(lhs) && lhs <= rhs
  65. }
  66. function string(data) {
  67. return "string" == typeof data
  68. }
  69. function nonEmptyString(data) {
  70. return string(data) && "" !== data
  71. }
  72. function object(data) {
  73. return "[object Object]" === toString.call(data)
  74. }
  75. function some(data, predicate) {
  76. for (var key in data)
  77. if (hasOwnProperty.call(data, key) && predicate(key, data[key]))
  78. return !0
  79. return !1
  80. }
  81. function instanceStrict(data, prototype) {
  82. try {
  83. return data instanceof prototype
  84. } catch (error) {
  85. return !1
  86. }
  87. }
  88. function like(data, archetype) {
  89. var name
  90. for (name in archetype)
  91. if (hasOwnProperty.call(archetype, name)) {
  92. if (
  93. !1 === hasOwnProperty.call(data, name) ||
  94. typeof data[name] != typeof archetype[name]
  95. )
  96. return !1
  97. if (
  98. object(data[name]) &&
  99. !1 === like(data[name], archetype[name])
  100. )
  101. return !1
  102. }
  103. return !0
  104. }
  105. function arrayLike(data) {
  106. return assigned(data) && data.length >= 0
  107. }
  108. function iterable(data) {
  109. return haveSymbols
  110. ? assigned(data) && isFunction(data[Symbol.iterator])
  111. : arrayLike(data)
  112. }
  113. function contains(data, value) {
  114. var iterator, iteration
  115. if (!assigned(data)) return !1
  116. if (haveSets && instanceStrict(data, Set)) return data.has(value)
  117. if (string(data)) return -1 !== data.indexOf(value)
  118. if (
  119. haveSymbols &&
  120. data[Symbol.iterator] &&
  121. isFunction(data.values)
  122. ) {
  123. iterator = data.values()
  124. do {
  125. if ((iteration = iterator.next()).value === value) return !0
  126. } while (!iteration.done)
  127. return !1
  128. }
  129. return some(data, function (key, dataValue) {
  130. return dataValue === value
  131. })
  132. }
  133. function containsKey(data, key) {
  134. return (
  135. !!assigned(data) &&
  136. (haveMaps && instanceStrict(data, Map)
  137. ? data.has(key)
  138. : !(iterable(data) && !number(+key)) && !!data[key])
  139. )
  140. }
  141. function isFunction(data) {
  142. return "function" == typeof data
  143. }
  144. function forEach(object, action) {
  145. for (var key in object)
  146. hasOwnProperty.call(object, key) && action(key, object[key])
  147. }
  148. function testArray(data, result) {
  149. var i
  150. for (i = 0; i < data.length; i += 1)
  151. if (data[i] === result) return result
  152. return !result
  153. }
  154. function testObject(data, result) {
  155. var key, value
  156. for (key in data)
  157. if (hasOwnProperty.call(data, key)) {
  158. if (
  159. object((value = data[key])) &&
  160. testObject(value, result) === result
  161. )
  162. return result
  163. if (value === result) return result
  164. }
  165. return !result
  166. }
  167. function mixin(target, source) {
  168. return (
  169. forEach(source, function (key, value) {
  170. target[key] = value
  171. }),
  172. target
  173. )
  174. }
  175. function assertModifier(predicate, defaultMessage) {
  176. return function () {
  177. var args = arguments,
  178. argCount = predicate.l || predicate.length,
  179. message = args[argCount],
  180. ErrorType = args[argCount + 1]
  181. return (
  182. assertImpl(
  183. predicate.apply(null, args),
  184. nonEmptyString(message)
  185. ? message
  186. : defaultMessage
  187. .replace("{a}", messageFormatter(args[0]))
  188. .replace("{e}", messageFormatter(args[1]))
  189. .replace("{e2}", messageFormatter(args[2]))
  190. .replace("{t}", function () {
  191. var arg = args[1]
  192. return arg && arg.name ? arg.name : arg
  193. }),
  194. isFunction(ErrorType) ? ErrorType : TypeError
  195. ),
  196. args[0]
  197. )
  198. }
  199. }
  200. function messageFormatter(arg) {
  201. return function () {
  202. return string(arg)
  203. ? '"' + arg.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"'
  204. : arg &&
  205. !0 !== arg &&
  206. arg.constructor &&
  207. !instanceStrict(arg, RegExp) &&
  208. "number" != typeof arg
  209. ? arg.constructor.name
  210. : arg
  211. }
  212. }
  213. function assertImpl(value, message, ErrorType) {
  214. if (value) return value
  215. throw new (ErrorType || Error)(message || "assert failed")
  216. }
  217. function notModifier(predicate) {
  218. var modifiedPredicate = function () {
  219. return notImpl(predicate.apply(null, arguments))
  220. }
  221. return (modifiedPredicate.l = predicate.length), modifiedPredicate
  222. }
  223. function notImpl(value) {
  224. return !value
  225. }
  226. function ofModifier(target, type, predicate) {
  227. var modifiedPredicate = function () {
  228. var collection, args
  229. if (
  230. ((collection = arguments[0]),
  231. "maybe" === target && not.assigned(collection))
  232. )
  233. return !0
  234. if (!type(collection)) return !1
  235. ;(collection = coerceCollection(type, collection)),
  236. (args = slice.call(arguments, 1))
  237. try {
  238. collection.forEach(function (item) {
  239. if (
  240. ("maybe" !== target || assigned(item)) &&
  241. !predicate.apply(null, [item].concat(args))
  242. )
  243. throw 0
  244. })
  245. } catch (ignore) {
  246. return !1
  247. }
  248. return !0
  249. }
  250. return (modifiedPredicate.l = predicate.length), modifiedPredicate
  251. }
  252. function coerceCollection(type, collection) {
  253. switch (type) {
  254. case arrayLike:
  255. return slice.call(collection)
  256. case object:
  257. return keys(collection).map(function (key) {
  258. return collection[key]
  259. })
  260. default:
  261. return collection
  262. }
  263. }
  264. function createModifiedPredicates(modifier, object) {
  265. return createModifiedFunctions([modifier, predicates, object, ""])
  266. }
  267. function createModifiedFunctions(args) {
  268. var modifier, messageModifier, object
  269. return (
  270. (modifier = args.shift()),
  271. (messageModifier = args.pop()),
  272. (object = args.pop()),
  273. forEach(args.pop(), function (key, fn) {
  274. var message = messages[key]
  275. message &&
  276. messageModifier &&
  277. (message = message.replace("to", messageModifier + "to")),
  278. Object.defineProperty(object, key, {
  279. configurable: !1,
  280. enumerable: !0,
  281. writable: !1,
  282. value: modifier.apply(null, args.concat(fn, message)),
  283. })
  284. }),
  285. object
  286. )
  287. }
  288. function createModifiedModifier(modifier, modified, messageModifier) {
  289. return createModifiedFunctions([
  290. modifier,
  291. modified,
  292. {},
  293. messageModifier,
  294. ])
  295. }
  296. function createOfModifiers(base, modifier) {
  297. collections.forEach(function (key) {
  298. base[key].of = createModifiedModifier(
  299. modifier,
  300. predicates[key].of
  301. )
  302. })
  303. }
  304. ;(messages = {}),
  305. (predicates = {}),
  306. [
  307. {
  308. n: "equal",
  309. f: function (lhs, rhs) {
  310. return lhs === rhs
  311. },
  312. s: "equal {e}",
  313. },
  314. {
  315. n: "undefined",
  316. f: function (data) {
  317. return void 0 === data
  318. },
  319. s: "be undefined",
  320. },
  321. {
  322. n: "null",
  323. f: function (data) {
  324. return null === data
  325. },
  326. s: "be null",
  327. },
  328. { n: "assigned", f: assigned, s: "be assigned" },
  329. {
  330. n: "primitive",
  331. f: function (data) {
  332. var type
  333. switch (data) {
  334. case null:
  335. case void 0:
  336. case !1:
  337. case !0:
  338. return !0
  339. }
  340. return (
  341. "string" === (type = typeof data) ||
  342. "number" === type ||
  343. (haveSymbols && "symbol" === type)
  344. )
  345. },
  346. s: "be primitive type",
  347. },
  348. { n: "contains", f: contains, s: "contain {e}" },
  349. {
  350. n: "in",
  351. f: function (value, data) {
  352. return contains(data, value)
  353. },
  354. s: "be in {e}",
  355. },
  356. { n: "containsKey", f: containsKey, s: "contain key {e}" },
  357. {
  358. n: "keyIn",
  359. f: function (key, data) {
  360. return containsKey(data, key)
  361. },
  362. s: "be key in {e}",
  363. },
  364. {
  365. n: "zero",
  366. f: function (data) {
  367. return 0 === data
  368. },
  369. s: "be 0",
  370. },
  371. {
  372. n: "one",
  373. f: function (data) {
  374. return 1 === data
  375. },
  376. s: "be 1",
  377. },
  378. {
  379. n: "infinity",
  380. f: function (data) {
  381. return data === neginf || data === posinf
  382. },
  383. s: "be infinity",
  384. },
  385. { n: "number", f: number, s: "be Number" },
  386. { n: "integer", f: integer, s: "be integer" },
  387. {
  388. n: "float",
  389. f: function (data) {
  390. return number(data) && data % 1 != 0
  391. },
  392. s: "be non-integer number",
  393. },
  394. {
  395. n: "even",
  396. f: function (data) {
  397. return "number" == typeof data && data % 2 == 0
  398. },
  399. s: "be even number",
  400. },
  401. {
  402. n: "odd",
  403. f: function (data) {
  404. return integer(data) && data % 2 != 0
  405. },
  406. s: "be odd number",
  407. },
  408. { n: "greater", f: greater, s: "be greater than {e}" },
  409. { n: "less", f: less, s: "be less than {e}" },
  410. {
  411. n: "between",
  412. f: function (data, x, y) {
  413. if (x < y) return greater(data, x) && data < y
  414. return less(data, x) && data > y
  415. },
  416. s: "be between {e} and {e2}",
  417. },
  418. {
  419. n: "greaterOrEqual",
  420. f: greaterOrEqual,
  421. s: "be greater than or equal to {e}",
  422. },
  423. {
  424. n: "lessOrEqual",
  425. f: lessOrEqual,
  426. s: "be less than or equal to {e}",
  427. },
  428. {
  429. n: "inRange",
  430. f: function (data, x, y) {
  431. if (x < y) return greaterOrEqual(data, x) && data <= y
  432. return lessOrEqual(data, x) && data >= y
  433. },
  434. s: "be in the range {e} to {e2}",
  435. },
  436. {
  437. n: "positive",
  438. f: function (data) {
  439. return greater(data, 0)
  440. },
  441. s: "be positive number",
  442. },
  443. {
  444. n: "negative",
  445. f: function (data) {
  446. return less(data, 0)
  447. },
  448. s: "be negative number",
  449. },
  450. { n: "string", f: string, s: "be String" },
  451. {
  452. n: "emptyString",
  453. f: function (data) {
  454. return "" === data
  455. },
  456. s: "be empty string",
  457. },
  458. {
  459. n: "nonEmptyString",
  460. f: nonEmptyString,
  461. s: "be non-empty string",
  462. },
  463. {
  464. n: "match",
  465. f: function (data, regex) {
  466. return string(data) && !!data.match(regex)
  467. },
  468. s: "match {e}",
  469. },
  470. {
  471. n: "boolean",
  472. f: function (data) {
  473. return !1 === data || !0 === data
  474. },
  475. s: "be Boolean",
  476. },
  477. { n: "object", f: object, s: "be Object" },
  478. {
  479. n: "emptyObject",
  480. f: function (data) {
  481. return (
  482. object(data) &&
  483. !some(data, function () {
  484. return !0
  485. })
  486. )
  487. },
  488. s: "be empty object",
  489. },
  490. {
  491. n: "nonEmptyObject",
  492. f: function (data) {
  493. return (
  494. object(data) &&
  495. some(data, function () {
  496. return !0
  497. })
  498. )
  499. },
  500. s: "be non-empty object",
  501. },
  502. {
  503. n: "instanceStrict",
  504. f: instanceStrict,
  505. s: "be instanceof {t}",
  506. },
  507. {
  508. n: "thenable",
  509. f: function (data) {
  510. return assigned(data) && isFunction(data.then)
  511. },
  512. s: "be promise-like",
  513. },
  514. {
  515. n: "instance",
  516. f: function (data, prototype) {
  517. try {
  518. return (
  519. instanceStrict(data, prototype) ||
  520. data.constructor.name === prototype.name ||
  521. toString.call(data) === "[object " + prototype.name + "]"
  522. )
  523. } catch (error) {
  524. return !1
  525. }
  526. },
  527. s: "be {t}",
  528. },
  529. { n: "like", f: like, s: "be like {e}" },
  530. {
  531. n: "array",
  532. f: function (data) {
  533. return isArray(data)
  534. },
  535. s: "be Array",
  536. },
  537. {
  538. n: "emptyArray",
  539. f: function (data) {
  540. return isArray(data) && 0 === data.length
  541. },
  542. s: "be empty array",
  543. },
  544. {
  545. n: "nonEmptyArray",
  546. f: function (data) {
  547. return isArray(data) && data.length > 0
  548. },
  549. s: "be non-empty array",
  550. },
  551. { n: "arrayLike", f: arrayLike, s: "be array-like" },
  552. { n: "iterable", f: iterable, s: "be iterable" },
  553. {
  554. n: "date",
  555. f: function (data) {
  556. return instanceStrict(data, Date) && integer(data.getTime())
  557. },
  558. s: "be valid Date",
  559. },
  560. { n: "function", f: isFunction, s: "be Function" },
  561. {
  562. n: "hasLength",
  563. f: function (data, length) {
  564. return assigned(data) && data.length === length
  565. },
  566. s: "have length {e}",
  567. },
  568. {
  569. n: "throws",
  570. f: function (data) {
  571. if (!isFunction(data)) return !1
  572. try {
  573. data()
  574. } catch (error) {
  575. return !0
  576. }
  577. return !1
  578. },
  579. s: "throw",
  580. },
  581. ].map(function (data) {
  582. var n = data.n
  583. ;(messages[n] = "assert failed: expected {a} to " + data.s),
  584. (predicates[n] = data.f)
  585. }),
  586. (functions = {
  587. map: function map(data, predicates) {
  588. var result
  589. result = isArray(data) ? [] : {}
  590. if (isFunction(predicates))
  591. forEach(data, function (key, value) {
  592. result[key] = predicates(value)
  593. })
  594. else {
  595. isArray(predicates) || assert.object(predicates)
  596. var dataKeys = keys(data || {})
  597. forEach(predicates, function (key, predicate) {
  598. dataKeys.some(function (dataKey, index) {
  599. return dataKey === key && (dataKeys.splice(index, 1), !0)
  600. }),
  601. isFunction(predicate)
  602. ? not.assigned(data)
  603. ? (result[key] = !!predicate.m)
  604. : (result[key] = predicate(data[key]))
  605. : (result[key] = map(data[key], predicate))
  606. })
  607. }
  608. return result
  609. },
  610. all: function (data) {
  611. if (isArray(data)) return testArray(data, !1)
  612. return assert.object(data), testObject(data, !1)
  613. },
  614. any: function (data) {
  615. if (isArray(data)) return testArray(data, !0)
  616. return assert.object(data), testObject(data, !0)
  617. },
  618. }),
  619. (collections = ["array", "arrayLike", "iterable", "object"]),
  620. (hasOwnProperty = Object.prototype.hasOwnProperty),
  621. (toString = Object.prototype.toString),
  622. (keys = Object.keys),
  623. (slice = Array.prototype.slice),
  624. (isArray = Array.isArray),
  625. (neginf = Number.NEGATIVE_INFINITY),
  626. (posinf = Number.POSITIVE_INFINITY),
  627. (haveSymbols = "function" == typeof Symbol),
  628. (haveMaps = "function" == typeof Map),
  629. (haveSets = "function" == typeof Set),
  630. (functions = mixin(functions, predicates)),
  631. (assert = createModifiedPredicates(assertModifier, assertImpl)),
  632. (not = createModifiedPredicates(notModifier, notImpl)),
  633. (maybe = createModifiedPredicates(
  634. function (predicate) {
  635. var modifiedPredicate = function () {
  636. return (
  637. !!not.assigned(arguments[0]) ||
  638. predicate.apply(null, arguments)
  639. )
  640. }
  641. return (
  642. (modifiedPredicate.l = predicate.length),
  643. (modifiedPredicate.m = !0),
  644. modifiedPredicate
  645. )
  646. },
  647. function (value) {
  648. if (!1 === assigned(value)) return !0
  649. return value
  650. }
  651. )),
  652. (assert.not = createModifiedModifier(assertModifier, not, "not ")),
  653. (assert.maybe = createModifiedModifier(
  654. assertModifier,
  655. maybe,
  656. "maybe "
  657. )),
  658. collections.forEach(function (key) {
  659. predicates[key].of = createModifiedFunctions([
  660. ofModifier.bind(null, null),
  661. predicates[key],
  662. predicates,
  663. {},
  664. "",
  665. ])
  666. }),
  667. createOfModifiers(assert, assertModifier),
  668. createOfModifiers(not, notModifier),
  669. collections.forEach(function (key) {
  670. ;(maybe[key].of = createModifiedFunctions([
  671. ofModifier.bind(null, "maybe"),
  672. predicates[key],
  673. predicates,
  674. {},
  675. "",
  676. ])),
  677. (assert.maybe[key].of = createModifiedModifier(
  678. assertModifier,
  679. maybe[key].of
  680. )),
  681. (assert.not[key].of = createModifiedModifier(
  682. assertModifier,
  683. not[key].of
  684. ))
  685. }),
  686. (function (functions) {
  687. void 0 ===
  688. (__WEBPACK_AMD_DEFINE_RESULT__ = function () {
  689. return functions
  690. }.call(exports, __webpack_require__, exports, module)) ||
  691. (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)
  692. })(mixin(functions, { assert, not, maybe }))
  693. })()
  694. },
  695. 228: module => {
  696. "use strict"
  697. const createAbortError = () => {
  698. const error = new Error("Delay aborted")
  699. return (error.name = "AbortError"), error
  700. },
  701. createDelay = ({
  702. clearTimeout: defaultClear,
  703. setTimeout: set,
  704. willResolve,
  705. }) => (ms, { value, signal } = {}) => {
  706. if (signal && signal.aborted)
  707. return Promise.reject(createAbortError())
  708. let timeoutId, settle, rejectFn
  709. const clear = defaultClear || clearTimeout,
  710. signalListener = () => {
  711. clear(timeoutId), rejectFn(createAbortError())
  712. },
  713. delayPromise = new Promise((resolve, reject) => {
  714. ;(settle = () => {
  715. signal && signal.removeEventListener("abort", signalListener),
  716. willResolve ? resolve(value) : reject(value)
  717. }),
  718. (rejectFn = reject),
  719. (timeoutId = (set || setTimeout)(settle, ms))
  720. })
  721. return (
  722. signal &&
  723. signal.addEventListener("abort", signalListener, { once: !0 }),
  724. (delayPromise.clear = () => {
  725. clear(timeoutId), (timeoutId = null), settle()
  726. }),
  727. delayPromise
  728. )
  729. },
  730. delay = createDelay({ willResolve: !0 })
  731. ;(delay.reject = createDelay({ willResolve: !1 })),
  732. (delay.range = (minimum, maximum, options) =>
  733. delay(
  734. ((minimum, maximum) =>
  735. Math.floor(Math.random() * (maximum - minimum + 1) + minimum))(
  736. minimum,
  737. maximum
  738. ),
  739. options
  740. )),
  741. (delay.createWithTimers = ({ clearTimeout, setTimeout }) => {
  742. const delay = createDelay({
  743. clearTimeout,
  744. setTimeout,
  745. willResolve: !0,
  746. })
  747. return (
  748. (delay.reject = createDelay({
  749. clearTimeout,
  750. setTimeout,
  751. willResolve: !1,
  752. })),
  753. delay
  754. )
  755. }),
  756. (module.exports = delay),
  757. (module.exports.default = delay)
  758. },
  759. },
  760. __webpack_module_cache__ = {}
  761. function __webpack_require__(moduleId) {
  762. if (__webpack_module_cache__[moduleId])
  763. return __webpack_module_cache__[moduleId].exports
  764. var module = (__webpack_module_cache__[moduleId] = { exports: {} })
  765. return (
  766. __webpack_modules__[moduleId].call(
  767. module.exports,
  768. module,
  769. module.exports,
  770. __webpack_require__
  771. ),
  772. module.exports
  773. )
  774. }
  775. ;(__webpack_require__.n = module => {
  776. var getter =
  777. module && module.__esModule ? () => module.default : () => module
  778. return __webpack_require__.d(getter, { a: getter }), getter
  779. }),
  780. (__webpack_require__.d = (exports, definition) => {
  781. for (var key in definition)
  782. __webpack_require__.o(definition, key) &&
  783. !__webpack_require__.o(exports, key) &&
  784. Object.defineProperty(exports, key, {
  785. enumerable: !0,
  786. get: definition[key],
  787. })
  788. }),
  789. (__webpack_require__.o = (obj, prop) =>
  790. Object.prototype.hasOwnProperty.call(obj, prop)),
  791. (() => {
  792. "use strict"
  793. const external_log_namespaceObject = log
  794. var external_log_default = __webpack_require__.n(
  795. external_log_namespaceObject
  796. )
  797. const lib = observer => value => {
  798. observer.next(value)
  799. },
  800. external_rxjs_namespaceObject = rxjs,
  801. external_rxjs_operators_namespaceObject = rxjs.operators,
  802. animateChat = (flowChat, flowChats, mainState, userConfig) => {
  803. var _a
  804. if (flowChat.animationEnded) return
  805. const duration = (userConfig => 96e3 / userConfig.flowSpeed)(
  806. userConfig
  807. ),
  808. time =
  809. null === (_a = flowChat.animation) || void 0 === _a
  810. ? void 0
  811. : _a.currentTime,
  812. progress = time ? time / flowChat.animationDuration : 0,
  813. newTime = time ? progress * duration : 0
  814. flowChat.lane = ((
  815. flowChat,
  816. progress,
  817. flowChats,
  818. mainState,
  819. userConfig
  820. ) => {
  821. const chatIndex = flowChats.indexOf(flowChat),
  822. playerWidth = mainState.playerRect.width,
  823. playerX = mainState.playerRect.x,
  824. chatRect = flowChat.element.getBoundingClientRect(),
  825. chatWidth = chatRect.width,
  826. chatX = progress ? chatRect.x - playerX : playerWidth,
  827. chatsByLane = Array.from({
  828. length: 2 * userConfig.laneCount - 1,
  829. }).map(() => [])
  830. flowChats
  831. .slice(0, chatIndex >= 0 ? chatIndex : void 0)
  832. .filter(chat => !chat.animationEnded)
  833. .forEach(chat => chatsByLane[chat.lane].push(chat))
  834. const occupiedChatCount = chats =>
  835. chats.filter(chat => {
  836. const otherRect = chat.element.getBoundingClientRect(),
  837. otherWidth = otherRect.width,
  838. otherX = otherRect.x - playerX,
  839. gap = (otherWidth * chatWidth) ** 0.5 / 3
  840. return (
  841. (playerWidth - otherX) / (playerWidth + otherWidth) -
  842. (null != progress ? progress : 0) <
  843. (chatWidth + gap) / (playerWidth + chatWidth) ||
  844. otherX + otherWidth + gap > chatX
  845. )
  846. }).length,
  847. occupiedChatCountByLane = Array.from({
  848. length: 2 * userConfig.laneCount - 1,
  849. }).map(() => 0)
  850. let laneNum =
  851. flowChat.lane < chatsByLane.length &&
  852. 0 === occupiedChatCount(chatsByLane[flowChat.lane])
  853. ? flowChat.lane
  854. : chatsByLane.findIndex((chats, i) => {
  855. const count = occupiedChatCount(chats)
  856. return (occupiedChatCountByLane[i] = count), 0 === count
  857. })
  858. return (
  859. -1 === laneNum &&
  860. ([[laneNum]] = [...occupiedChatCountByLane.entries()].sort(
  861. (a, b) => a[1] - b[1]
  862. )),
  863. laneNum
  864. )
  865. })(flowChat, progress, flowChats, mainState, userConfig)
  866. const laneY = ((lane, mainState, userConfig) => {
  867. const { laneCount } = userConfig,
  868. laneR = lane % (2 * laneCount - 1),
  869. playerHeight = mainState.playerRect.height
  870. return (
  871. Math.round(
  872. 100 *
  873. (laneR < laneCount
  874. ? (playerHeight * (laneR % laneCount)) / laneCount + 4
  875. : playerHeight *
  876. ((laneR % laneCount) / laneCount + 1 / (2 * laneCount)))
  877. ) / 100
  878. )
  879. })(flowChat.lane, mainState, userConfig)
  880. flowChat.animation && flowChat.animation.cancel(),
  881. (flowChat.animationDuration = duration),
  882. (flowChat.animation = flowChat.element.animate(
  883. [
  884. {
  885. transform: `translate(${mainState.playerRect.width}px, ${laneY}px)`,
  886. },
  887. { transform: `translate(-100%, ${laneY}px)` },
  888. ],
  889. { duration, easing: userConfig.timingFunction }
  890. )),
  891. (flowChat.animation.currentTime = newTime),
  892. mainState.videoPlaying
  893. ? flowChat.animation.play()
  894. : flowChat.animation.pause(),
  895. (flowChat.animation.onfinish = () => {
  896. flowChat.animationEnded = !0
  897. })
  898. }
  899. const assert_lib = __webpack_require__(494).assert,
  900. tapNonNull = x => (assert_lib(null != x), x),
  901. parseMessage = (lengthBefore, message, userConfig) => {
  902. const { maxChatLength } = userConfig
  903. let html = "",
  904. length = lengthBefore
  905. return (
  906. message.innerHTML.split(/(?=<img)|">/g).some(part => {
  907. if (part.match(/^<img/)) {
  908. if (!userConfig.textOnly) {
  909. const src = part.match(/src="(\\.|[^"\\])*"/g)
  910. ;(html += `<img ${src} style="height: 1em">`), (length += 1)
  911. }
  912. } else
  913. (html +=
  914. part.length >= maxChatLength
  915. ? part.substr(0, maxChatLength)
  916. : part),
  917. (length += part.length)
  918. return length >= maxChatLength
  919. }),
  920. { html, length }
  921. )
  922. },
  923. external_m_namespaceObject = m
  924. var external_m_default = __webpack_require__.n(external_m_namespaceObject)
  925. const external_Swal_namespaceObject = Swal
  926. var external_Swal_default = __webpack_require__.n(
  927. external_Swal_namespaceObject
  928. )
  929. const logFyc = (...x) => external_log_default().info(`【FYC ${x}`),
  930. createBanButton = (chat, id, userConfig) => {
  931. var _a, _b
  932. if (chat.children.namedItem("card")) return
  933. const button = document.createElement("button")
  934. button.classList.add(
  935. "style-scope",
  936. "yt-icon-button",
  937. "fyc_button",
  938. "fyc_ngbutton"
  939. ),
  940. (button.style.padding = "0px"),
  941. (button.style.width = "20px"),
  942. (button.style.height = "20px"),
  943. (button.style.fill = "#fff"),
  944. button.setAttribute("aria-label", "NGに入れる"),
  945. (button.innerHTML =
  946. '<div style="width: 100%; height: 75%;fill: var(--yt-spec-text-secondary);"><svg class="style-scope yt-icon" width="100%" height="100%" version="1.1" viewBox="0 0 512 512" x="0px" y="0px"><path d="M437.023,74.977c-99.984-99.969-262.063-99.969-362.047,0c-99.969,99.984-99.969,262.063,0,362.047c99.969,99.969,262.078,99.969,362.047,0S536.992,174.945,437.023,74.977z M137.211,137.211c54.391-54.391,137.016-63.453,201.016-27.531L109.68,338.227C73.758,274.227,82.82,191.602,137.211,137.211z M374.805,374.789c-54.391,54.391-137.031,63.469-201.031,27.547l228.563-228.563C438.258,237.773,429.18,320.414,374.805,374.789z" fill-rule="evenodd"></path></svg></div>'),
  947. (button.onclick = () => {
  948. logFyc(`Added to Banned Users: ${id}`),
  949. userConfig.bannedUsers.push(id),
  950. GM.setValue("FYC_NG_USERS", userConfig.bannedUsers.join("\n")),
  951. external_m_default().redraw(),
  952. (chat.style.display = "none"),
  953. external_Swal_default()
  954. .mixin({
  955. toast: !0,
  956. position: "bottom-left",
  957. timer: 2500,
  958. timerProgressBar: !0,
  959. showConfirmButton: !1,
  960. didOpen: toast => {
  961. toast.addEventListener(
  962. "mouseenter",
  963. external_Swal_default().stopTimer
  964. ),
  965. toast.addEventListener(
  966. "mouseleave",
  967. external_Swal_default().resumeTimer
  968. )
  969. },
  970. })
  971. .fire({ title: `Added Banned User: ${id}`, icon: "success" })
  972. }),
  973. external_log_default().debug("AppendNgButton"),
  974. null ===
  975. (_b =
  976. null === (_a = chat.querySelector("#content")) || void 0 === _a
  977. ? void 0
  978. : _a.querySelector("message")) ||
  979. void 0 === _b ||
  980. _b.append(button)
  981. },
  982. livePage_getPlayer = () => {
  983. var _a
  984. return null !== (_a = document.querySelector("#movie_player")) &&
  985. void 0 !== _a
  986. ? _a
  987. : void 0
  988. },
  989. livePage_getMainVideo = () => {
  990. var _a
  991. return null !==
  992. (_a = document.querySelector(
  993. "video.video-stream.html5-main-video"
  994. )) && void 0 !== _a
  995. ? _a
  996. : void 0
  997. },
  998. livePage_getChatFrame = () => {
  999. var _a
  1000. return null !== (_a = document.querySelector("#chatframe")) &&
  1001. void 0 !== _a
  1002. ? _a
  1003. : void 0
  1004. },
  1005. livePage_getChatField = () => {
  1006. var _a, _b, _c
  1007. return null !==
  1008. (_c = (null !==
  1009. (_b =
  1010. null === (_a = document.querySelector("#chatframe")) ||
  1011. void 0 === _a
  1012. ? void 0
  1013. : _a.contentDocument) && void 0 !== _b
  1014. ? _b
  1015. : document
  1016. ).querySelector(
  1017. "#items.style-scope.yt-live-chat-item-list-renderer"
  1018. )) && void 0 !== _c
  1019. ? _c
  1020. : void 0
  1021. },
  1022. stylizeChat = (flowChat, userConfig) => {
  1023. const fontSize = (userConfig => {
  1024. var _a, _b
  1025. return (
  1026. Math.round(
  1027. (userConfig.fontSize - 0.2) *
  1028. ((null !==
  1029. (_b =
  1030. null === (_a = livePage_getMainVideo()) || void 0 === _a
  1031. ? void 0
  1032. : _a.clientHeight) && void 0 !== _b
  1033. ? _b
  1034. : 0) /
  1035. userConfig.laneCount) *
  1036. 100
  1037. ) / 100
  1038. )
  1039. })(userConfig),
  1040. offset = userConfig.shadowFontWeight,
  1041. { style } = flowChat.element
  1042. ;(style.visibility = userConfig.displayChats ? "visible" : "hidden"),
  1043. (style.color = flowChat.color),
  1044. (style.fontSize = `${fontSize}px`),
  1045. (style.fontWeight = userConfig.fontWeight.toString()),
  1046. (style.fontFamily = userConfig.font),
  1047. (style.opacity = userConfig.chatOpacity.toString()),
  1048. (style.textShadow = `-${offset}px -${offset}px #000, ${offset}px -${offset}px #000, -${offset}px ${offset}px #000, ${offset}px ${offset}px #000`)
  1049. },
  1050. chatFieldObserver = (chatScrn, flowChats, mainState, userConfig) =>
  1051. new MutationObserver(mutations => {
  1052. mutations.forEach(e => {
  1053. Array.from(e.addedNodes)
  1054. .filter(x => x.children.length > 0)
  1055. .forEach(chat => {
  1056. const chatData = ((chat, userConfig) => {
  1057. let html = "",
  1058. length = 0
  1059. const isMember = Boolean(chat.querySelector(".member"))
  1060. let authorID
  1061. const color = chat.querySelector(".owner")
  1062. ? userConfig.ownerColor
  1063. : chat.querySelector(".moderator")
  1064. ? userConfig.moderatorColor
  1065. : isMember
  1066. ? userConfig.memberColor
  1067. : userConfig.color
  1068. return (
  1069. Array.from(chat.children).forEach(child => {
  1070. var _a, _b, _c, _d
  1071. const childID = child.id,
  1072. message = child.querySelector("#message"),
  1073. authorName = child.querySelector("#author-name")
  1074. if (
  1075. "content" === childID &&
  1076. (chat.querySelector(".moderator") &&
  1077. !0 === userConfig.displayModeratorName &&
  1078. (html += `<span style="font-size: smaller;">${
  1079. null == authorName ? void 0 : authorName.innerText
  1080. }: </span>`),
  1081. message)
  1082. ) {
  1083. const result = parseMessage(
  1084. length,
  1085. message,
  1086. userConfig
  1087. )
  1088. ;(html += result.html), (length += result.length)
  1089. }
  1090. if ("author-photo" === childID) {
  1091. const matches = (
  1092. (null === (_a = child.lastElementChild) ||
  1093. void 0 === _a
  1094. ? void 0
  1095. : _a.getAttribute("src")) || ""
  1096. ).match(/ytc\/(.*)=/)
  1097. authorID =
  1098. null == matches
  1099. ? void 0
  1100. : matches[matches.length - 1]
  1101. }
  1102. if ("card" === childID) {
  1103. const paidAmount =
  1104. child.querySelector("#purchase-amount") ||
  1105. child.querySelector("#purchase-amount-chip")
  1106. if (
  1107. child.matches(
  1108. [
  1109. ".style-scope",
  1110. ".yt-live-chat-paid-message-renderer",
  1111. ].join("")
  1112. )
  1113. ) {
  1114. const header = tapNonNull(
  1115. child.querySelector("#header")
  1116. ),
  1117. content = child.querySelector("#content"),
  1118. headerColor = window
  1119. .getComputedStyle(header)
  1120. .getPropertyValue("background-color"),
  1121. paidColor = window
  1122. .getComputedStyle(content)
  1123. .getPropertyValue("background-color")
  1124. if (message) {
  1125. const result = parseMessage(
  1126. length,
  1127. message,
  1128. userConfig
  1129. )
  1130. ;(html += `<span style="color: ${headerColor}; font-size: smaller;">${
  1131. null == authorName
  1132. ? void 0
  1133. : authorName.innerText
  1134. }: </span><span style="color: ${headerColor};">${
  1135. result.html
  1136. }</span><span style="color: ${paidColor}; font-size: smaller;"><strong>${
  1137. null == paidAmount
  1138. ? void 0
  1139. : paidAmount.innerText
  1140. }</strong></span>`),
  1141. (length +=
  1142. result.length +
  1143. (null !==
  1144. (_b =
  1145. null == paidAmount
  1146. ? void 0
  1147. : paidAmount.innerText.length) &&
  1148. void 0 !== _b
  1149. ? _b
  1150. : 0))
  1151. }
  1152. authorID = void 0
  1153. }
  1154. if (
  1155. child.matches(
  1156. [
  1157. ".style-scope",
  1158. ".yt-live-chat-paid-sticker-renderer",
  1159. ].join("")
  1160. )
  1161. ) {
  1162. const headerColor = window
  1163. .getComputedStyle(chat)
  1164. .getPropertyValue(
  1165. "--yt-live-chat-paid-sticker-chip-background-color"
  1166. ),
  1167. amountColor = window
  1168. .getComputedStyle(chat)
  1169. .getPropertyValue(
  1170. "--yt-live-chat-paid-sticker-background-color"
  1171. )
  1172. ;(html += `<span style="color: ${headerColor};">${
  1173. null == authorName ? void 0 : authorName.innerText
  1174. }: </span>`),
  1175. (html += `<span style="color: ${amountColor}; font-size: smaller;"><strong>${
  1176. null == paidAmount
  1177. ? void 0
  1178. : paidAmount.innerText
  1179. }</strong></span>`),
  1180. (length +=
  1181. null !==
  1182. (_d =
  1183. null ===
  1184. (_c =
  1185. null == paidAmount
  1186. ? void 0
  1187. : paidAmount.innerText) ||
  1188. void 0 === _c
  1189. ? void 0
  1190. : _c.length) && void 0 !== _d
  1191. ? _d
  1192. : 0),
  1193. (authorID = void 0)
  1194. }
  1195. }
  1196. }),
  1197. { html, length, color, authorID }
  1198. )
  1199. })(chat, userConfig)
  1200. ;((chatData, userConfig) =>
  1201. userConfig.bannedWords.some(
  1202. word =>
  1203. !!chatData.html.includes(word) &&
  1204. (external_log_default().debug(
  1205. `Banned Word: "${word}" in "${chatData.html}"`
  1206. ),
  1207. !0)
  1208. ))(chatData, userConfig) ||
  1209. ((chatData, userConfig) =>
  1210. userConfig.bannedWordRegexs.some(word => {
  1211. const result = chatData.html.match(word)
  1212. return (
  1213. !!result &&
  1214. (external_log_default().debug(
  1215. `Banned Word: "${result}" in "${chatData.html}"`
  1216. ),
  1217. !0)
  1218. )
  1219. }))(chatData, userConfig) ||
  1220. ((chatData, userConfig) =>
  1221. Boolean(chatData.authorID) &&
  1222. userConfig.bannedUsers.some(user => {
  1223. var _a
  1224. const result =
  1225. null === (_a = chatData.authorID) || void 0 === _a
  1226. ? void 0
  1227. : _a.match(user)
  1228. return (
  1229. !!result &&
  1230. (external_log_default().debug(
  1231. `Banned User: "${result}" in "${chatData.html}"`
  1232. ),
  1233. !0)
  1234. )
  1235. }))(chatData, userConfig)
  1236. ? (chat.style.display = "none")
  1237. : ((chat.style.display =
  1238. chat.querySelectorAll(
  1239. ".style-scope.yt-live-chat-paid-message-renderer"
  1240. ).length > 0
  1241. ? "block"
  1242. : "flex"),
  1243. userConfig.createChats &&
  1244. ((
  1245. chatData,
  1246. flowChats,
  1247. chatScrn,
  1248. mainState,
  1249. userConfig
  1250. ) => {
  1251. let element
  1252. const offScreenChatIndex = flowChats.findIndex(
  1253. chat =>
  1254. chat.animationEnded ||
  1255. flowChats.length >= userConfig.maxChatCount
  1256. )
  1257. ;-1 !== offScreenChatIndex
  1258. ? ((element =
  1259. flowChats[offScreenChatIndex].element),
  1260. flowChats.splice(offScreenChatIndex, 1))
  1261. : (external_log_default().debug("CreateFlowChat"),
  1262. (element = document.createElement("span")),
  1263. chatScrn.append(element)),
  1264. element.classList.add("fyc_chat")
  1265. const flowChat = {
  1266. element,
  1267. lane: 0,
  1268. animation: void 0,
  1269. animationDuration: 0,
  1270. animationEnded: !1,
  1271. length: chatData.length,
  1272. color: chatData.color,
  1273. }
  1274. ;(element.innerHTML = chatData.html),
  1275. stylizeChat(flowChat, userConfig),
  1276. animateChat(
  1277. flowChat,
  1278. flowChats,
  1279. mainState,
  1280. userConfig
  1281. ),
  1282. flowChats.push(flowChat)
  1283. })(
  1284. chatData,
  1285. flowChats,
  1286. chatScrn,
  1287. mainState,
  1288. userConfig
  1289. ),
  1290. userConfig.createBanButtons &&
  1291. chatData.authorID &&
  1292. !chat.querySelector(".owner") &&
  1293. createBanButton(chat, chatData.authorID, userConfig),
  1294. ((chat, simplify) => {
  1295. if (
  1296. ((chat.style.borderBottom = simplify
  1297. ? "1px solid var(--yt-spec-text-secondary)"
  1298. : "none"),
  1299. chat.querySelector(
  1300. ".style-scope.yt-live-chat-paid-message-renderer"
  1301. ) || chat.querySelector(".owner"))
  1302. )
  1303. return
  1304. const authorPhoto = chat.querySelector("#author-photo")
  1305. authorPhoto &&
  1306. (authorPhoto.style.display = simplify
  1307. ? "none"
  1308. : "block")
  1309. const authorChip = chat.querySelector(
  1310. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer"
  1311. )
  1312. authorChip &&
  1313. (authorChip.style.display = simplify
  1314. ? "none"
  1315. : "inline-flex")
  1316. })(chat, userConfig.simplifyChatField))
  1317. })
  1318. })
  1319. }),
  1320. componentMounter = (root, placeRoot) => component => {
  1321. const success = placeRoot(root)
  1322. return success && external_m_default().mount(root, component), success
  1323. },
  1324. createScriptCss = () => {
  1325. let styleHtml = ""
  1326. ;(styleHtml +=
  1327. ".fyc_chat {\n line-height: 1;\n z-index: 30;\n position: absolute;\n user-select: none;\n white-space: nowrap;\n animation-fill-mode: none;\n will-change: transform;\n transform: translate(-100%);\n }"),
  1328. (styleHtml +=
  1329. ".fyc_chat > img {\n vertical-align: text-top;\n }"),
  1330. (styleHtml +=
  1331. ".fyc_button {\n display: inline-block;\n border-style: none;\n z-index: 4;\n font-weight: 500;\n color: var(--yt-spec-text-secondary);\n }"),
  1332. external_log_default().debug("AppendCss")
  1333. const existedElement = document.querySelector(".fyc_style"),
  1334. styleElement =
  1335. null != existedElement
  1336. ? existedElement
  1337. : document.createElement("style")
  1338. existedElement ||
  1339. (document.head.append(styleElement),
  1340. styleElement.classList.add(".fyc_style")),
  1341. (styleElement.innerHTML =
  1342. ".fyc_chat {\n line-height: 1;\n z-index: 30;\n position: absolute;\n user-select: none;\n white-space: nowrap;\n animation-fill-mode: none;\n will-change: transform;\n transform: translate(-100%);\n }.fyc_chat > img {\n vertical-align: text-top;\n }.fyc_button {\n display: inline-block;\n border-style: none;\n z-index: 4;\n font-weight: 500;\n color: var(--yt-spec-text-secondary);\n }")
  1343. }
  1344. var delay = __webpack_require__(228),
  1345. delay_default = __webpack_require__.n(delay)
  1346. const setChatFrameCss = async () => (
  1347. await delay_default()(700),
  1348. (async (func, count, interval) => {
  1349. let exception,
  1350. succeed = !1
  1351. for (let i = 0; i < count; i += 1) {
  1352. try {
  1353. await func(i), (succeed = !0)
  1354. break
  1355. } catch (e) {
  1356. exception = e
  1357. }
  1358. external_log_default().debug("Retry"),
  1359. await delay_default()(interval)
  1360. }
  1361. if (!succeed) throw exception
  1362. })(
  1363. () => {
  1364. var _a, _b
  1365. const element =
  1366. null ===
  1367. (_b =
  1368. null === (_a = document.querySelector("#chatframe")) ||
  1369. void 0 === _a
  1370. ? void 0
  1371. : _a.contentDocument) || void 0 === _b
  1372. ? void 0
  1373. : _b.querySelector(
  1374. "#item-scroller.animated.yt-live-chat-item-list-renderer #item-offset.yt-live-chat-item-list-renderer"
  1375. )
  1376. element && (element.style.overflow = "unset")
  1377. },
  1378. 5,
  1379. 1e3
  1380. )
  1381. ),
  1382. settingPanel_option = (value, label) =>
  1383. external_m_default()("option", { value }, label),
  1384. settingRow = (label, content) =>
  1385. external_m_default()("div", [
  1386. external_m_default()("span", label),
  1387. external_m_default()("div", content),
  1388. ]),
  1389. textColorRow = (color, textStyle, oninput) =>
  1390. external_m_default()("div", [
  1391. external_m_default()("input", {
  1392. type: "text",
  1393. size: 10,
  1394. maxlength: 30,
  1395. value: color,
  1396. oninput,
  1397. }),
  1398. external_m_default()(
  1399. "span",
  1400. { style: { ...textStyle, color } },
  1401. "Aa1あア亜"
  1402. ),
  1403. ]),
  1404. rangeRow = (min, max, step, value, oninput) =>
  1405. external_m_default()("div", [
  1406. external_m_default()("input", {
  1407. style: { width: "150px", verticalAlign: "middle" },
  1408. type: "range",
  1409. min,
  1410. max,
  1411. step,
  1412. value,
  1413. oninput,
  1414. }),
  1415. external_m_default()("input", {
  1416. style: {
  1417. width: "30px",
  1418. backgroundColor: "transparent",
  1419. color: "inherit",
  1420. borderWidth: "1px",
  1421. verticalAlign: "middle",
  1422. },
  1423. inputmode: "decimal",
  1424. value,
  1425. onchange: oninput,
  1426. }),
  1427. ]),
  1428. checkboxRow = (label, checked, onchange) =>
  1429. external_m_default()(
  1430. "div",
  1431. external_m_default()("label", [
  1432. label,
  1433. external_m_default()("input", {
  1434. type: "checkbox",
  1435. checked,
  1436. onchange,
  1437. }),
  1438. ])
  1439. ),
  1440. getInputValue = e => {
  1441. const target = e.currentTarget
  1442. if (
  1443. target instanceof HTMLSelectElement ||
  1444. target instanceof HTMLTextAreaElement ||
  1445. target instanceof HTMLInputElement
  1446. )
  1447. return target.value
  1448. throw Error(
  1449. "Event target isn't an Input or TextArea or Input element"
  1450. )
  1451. },
  1452. getInputChecked = e => {
  1453. return ((constructor = HTMLInputElement),
  1454. (x = e.currentTarget),
  1455. assert_lib(x instanceof constructor),
  1456. x).checked
  1457. var constructor, x
  1458. },
  1459. langRecord = {
  1460. FYC_EN: {
  1461. language: "Language",
  1462. font: "Font",
  1463. color: "Color(Normal)",
  1464. ownerColor: "Color(Owner)",
  1465. moderatorColor: "Color(Moderator)",
  1466. memberColor: "Color(Member)",
  1467. feedback: "Give your feedbacks here",
  1468. chatOpacity: "Opacity",
  1469. fontSize: "Size",
  1470. fontWeight: "Weight",
  1471. shadowFontWeight: "Weight(Shadow)",
  1472. flowSpeed: "Speed",
  1473. maxChatCount: "Max number of chats",
  1474. maxChatLength: "Max number of characters",
  1475. laneCount: "Number of Line",
  1476. bannedWords: "Banned Words",
  1477. bannedWordRegexs: "Banned Words(Regex)",
  1478. bannedUsers: "Banned Users",
  1479. simplifyChatField: "Simplify",
  1480. createBanButton: "Show ban button",
  1481. displayModeratorName: "Show moderator's name",
  1482. createChats: "Display flowing chats",
  1483. textOnly: "Text only(ignore emojis)",
  1484. reload: "Reload",
  1485. save: "Save",
  1486. error: "Error",
  1487. video: "Video",
  1488. chatField: "Chat Window",
  1489. useStepTiming: "Move chat in steps",
  1490. timingStepCount: "└Step Count",
  1491. },
  1492. FYC_JA: {
  1493. language: "言語",
  1494. font: "フォント",
  1495. color: "色(通常)",
  1496. ownerColor: "色(オーナー)",
  1497. moderatorColor: "色(モデレーター)",
  1498. memberColor: "色(メンバー)",
  1499. feedback: "バグ報告、要望はこちら",
  1500. chatOpacity: "透明度",
  1501. fontSize: "サイズ",
  1502. fontWeight: "太さ",
  1503. shadowFontWeight: "太さ(影)",
  1504. flowSpeed: "速度",
  1505. maxChatCount: "最大表示数",
  1506. maxChatLength: "最大文字数",
  1507. laneCount: "行数",
  1508. bannedWords: "NGワード",
  1509. bannedWordRegexs: "NGワード(正規表現)",
  1510. bannedUsers: "NGユーザー",
  1511. simplifyChatField: "簡略化する",
  1512. createBanButton: "NGボタンを表示する",
  1513. displayModeratorName: "モデレータの名前を表示する",
  1514. createChats: "チャットを流す",
  1515. textOnly: "文字のみ(絵文字を無視する)",
  1516. reload: "再読み込み",
  1517. save: "保存",
  1518. error: "エラー",
  1519. video: "画面",
  1520. chatField: "チャット欄",
  1521. useStepTiming: "チャットを段階的に動かす",
  1522. timingStepCount: "└段階数",
  1523. },
  1524. },
  1525. langOptions = [
  1526. ["FYC_EN", "English"],
  1527. ["FYC_JA", "日本語"],
  1528. ],
  1529. fontOptions = [
  1530. ["", "Default", "デフォルト"],
  1531. ["arial", "Arial", "Arial"],
  1532. ["arial black", "Arial Black", "Arial Black"],
  1533. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  1534. ["Century", "Century", "Century"],
  1535. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  1536. ["Courier", "Courier", "Courier"],
  1537. ["cursive", "cursive", "cursive"],
  1538. ["fantasy", "fantasy", "fantasy"],
  1539. ["Impact", "Impact", "Impact"],
  1540. ["Meiryo", "Meiryo", "メイリオ"],
  1541. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  1542. ["monospace", "monospace", "monospace"],
  1543. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  1544. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  1545. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  1546. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  1547. ["MS Serif", "MS Serif", "MS Serif"],
  1548. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  1549. ["sans-serif", "Sans-serif", "Sans-serif"],
  1550. ["serif", "Serif", "Serif"],
  1551. ["Times New Roman", "Times New Roman", "Times New Roman"],
  1552. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  1553. ["YuGothic", "YuGothic", "游ゴシック体"],
  1554. ],
  1555. settingPanel = (
  1556. flowChats,
  1557. recreateCss,
  1558. mainState,
  1559. state,
  1560. userConfig
  1561. ) => {
  1562. var _a, _b
  1563. const exampleTextStyle = () => ({
  1564. fontFamily: userConfig.font,
  1565. fontWeight: userConfig.fontWeight.toString(),
  1566. }),
  1567. panelState = {
  1568. bannedWordRegexs: userConfig.bannedWordRegexs,
  1569. bannedWordRegexsValid: !0,
  1570. bannedWordRegexsError: "",
  1571. currentBanTab: 0,
  1572. timingStepCount: parseInt(
  1573. null !==
  1574. (_b =
  1575. null ===
  1576. (_a = userConfig.timingFunction.match(
  1577. /^steps\((\d+),.+/
  1578. )) || void 0 === _a
  1579. ? void 0
  1580. : _a[1]) && void 0 !== _b
  1581. ? _b
  1582. : "150",
  1583. 10
  1584. ),
  1585. },
  1586. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  1587. useStepTiming = () =>
  1588. Boolean(userConfig.timingFunction.match(/^steps\(.+/)),
  1589. panelBoxStyle = { flex: "0 0 212px", margin: "2px" },
  1590. textAreaStyle = {
  1591. resize: "horizontal",
  1592. boxSizing: "border-box",
  1593. width: "100%",
  1594. },
  1595. fieldSetStyle = { border: "solid 1px", padding: "3px" },
  1596. getLang = () => langRecord[userConfig.lang],
  1597. langSelectChange$ = new external_rxjs_namespaceObject.Subject(),
  1598. fontSelectChange$ = new external_rxjs_namespaceObject.Subject(),
  1599. colorInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1600. colorOwnerInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1601. colorModeratorInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1602. colorMemberInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1603. chatOpacityInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1604. fontSizeInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1605. fontWeightInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1606. shadowFontWeightInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1607. flowSpeedInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1608. maxChatCountInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1609. maxChatLengthInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1610. laneCountInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1611. banTabChange$ = new external_rxjs_namespaceObject.Subject(),
  1612. bannedWordsTextAreaChange$ = new external_rxjs_namespaceObject.Subject(),
  1613. bannedWordRegexsTextAreaChange$ = new external_rxjs_namespaceObject.Subject(),
  1614. bannedUsersTextAreaChange$ = new external_rxjs_namespaceObject.Subject(),
  1615. simplifyChatFieldInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1616. createBanButtonInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1617. displayModeratorNameInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1618. createChatsInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1619. textOnlyInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1620. useStepTimingInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1621. timingStepCountInputChange$ = new external_rxjs_namespaceObject.Subject()
  1622. return (
  1623. (0, external_rxjs_namespaceObject.merge)(
  1624. langSelectChange$.pipe(
  1625. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1626. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1627. ;(userConfig.lang = x), GM.setValue("FYC_LANG", x)
  1628. })
  1629. ),
  1630. fontSelectChange$.pipe(
  1631. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1632. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1633. ;(userConfig.font = x), GM.setValue("FYC_FONT", x)
  1634. })
  1635. ),
  1636. colorInputInput$.pipe(
  1637. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1638. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1639. ;(userConfig.color = x), GM.setValue("FYC_COLOR", x)
  1640. })
  1641. ),
  1642. colorOwnerInputInput$.pipe(
  1643. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1644. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1645. ;(userConfig.ownerColor = x),
  1646. GM.setValue("FYC_COLOR_OWNER", x)
  1647. })
  1648. ),
  1649. colorModeratorInputInput$.pipe(
  1650. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1651. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1652. ;(userConfig.moderatorColor = x),
  1653. GM.setValue("FYC_COLOR_MODERATOR", x)
  1654. })
  1655. ),
  1656. colorMemberInputInput$.pipe(
  1657. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1658. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1659. ;(userConfig.memberColor = x),
  1660. GM.setValue("FYC_COLOR_MEMBER", x)
  1661. })
  1662. ),
  1663. chatOpacityInputInput$.pipe(
  1664. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1665. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1666. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1667. ;(userConfig.chatOpacity = x), GM.setValue("FYC_OPACITY", x)
  1668. })
  1669. ),
  1670. fontSizeInputInput$.pipe(
  1671. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1672. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1673. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1674. ;(userConfig.fontSize = x), GM.setValue("FYC_SIZE", x)
  1675. })
  1676. ),
  1677. fontWeightInputInput$.pipe(
  1678. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1679. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1680. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1681. ;(userConfig.fontWeight = x), GM.setValue("FYC_WEIGHT", x)
  1682. })
  1683. ),
  1684. shadowFontWeightInputInput$.pipe(
  1685. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1686. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1687. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1688. ;(userConfig.shadowFontWeight = x),
  1689. GM.setValue("FYC_WEIGHT_SHADOW", x)
  1690. })
  1691. ),
  1692. flowSpeedInputInput$.pipe(
  1693. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1694. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1695. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1696. ;(userConfig.flowSpeed = x), GM.setValue("FYC_SPEED", x)
  1697. })
  1698. ),
  1699. maxChatCountInputInput$.pipe(
  1700. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1701. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1702. parseInt(x, 10)
  1703. ),
  1704. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1705. ;(userConfig.maxChatCount = x),
  1706. ((flowChats, maxChatCount) => {
  1707. flowChats
  1708. .splice(0, Math.max(0, flowChats.length - maxChatCount))
  1709. .forEach(x => {
  1710. external_log_default().debug("RemoveOldChat"),
  1711. x.element.remove()
  1712. })
  1713. })(flowChats, x),
  1714. GM.setValue("FYC_LIMIT", x)
  1715. })
  1716. ),
  1717. maxChatLengthInputInput$.pipe(
  1718. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1719. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1720. parseInt(x, 10)
  1721. ),
  1722. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1723. ;(userConfig.maxChatLength = x), GM.setValue("FYC_MAX", x)
  1724. })
  1725. ),
  1726. laneCountInputInput$.pipe(
  1727. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1728. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1729. parseInt(x, 10)
  1730. ),
  1731. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1732. ;(userConfig.laneCount = x), GM.setValue("FYC_LANE_DIV", x)
  1733. })
  1734. ),
  1735. banTabChange$.pipe(
  1736. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1737. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1738. parseInt(x, 10)
  1739. ),
  1740. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1741. panelState.currentBanTab = x
  1742. })
  1743. ),
  1744. bannedWordsTextAreaChange$.pipe(
  1745. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1746. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1747. x.split(/\r\n|\n/).filter(word => "" !== word)
  1748. ),
  1749. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1750. ;(userConfig.bannedWords = x),
  1751. GM.setValue("FYC_NG_WORDS", x.join("\n"))
  1752. })
  1753. ),
  1754. bannedWordRegexsTextAreaChange$.pipe(
  1755. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1756. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1757. x.split(/\r\n|\n/).filter(regex => "" !== regex)
  1758. ),
  1759. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1760. panelState.bannedWordRegexs = x
  1761. let valid = !0
  1762. ;(panelState.bannedWordRegexsError = ""),
  1763. panelState.bannedWordRegexs.forEach(regex => {
  1764. try {
  1765. new RegExp(regex)
  1766. } catch (error) {
  1767. logFyc(`Invalid Regex: ${regex}`),
  1768. external_log_default().warn(error),
  1769. (panelState.bannedWordRegexsError += `${error} in ${regex};`),
  1770. (valid = !1)
  1771. }
  1772. }),
  1773. valid &&
  1774. ((userConfig.bannedWordRegexs = x),
  1775. GM.setValue("FYC_NG_REG_WORDS", x.join("\n"))),
  1776. (panelState.bannedWordRegexsValid = valid)
  1777. })
  1778. ),
  1779. bannedUsersTextAreaChange$.pipe(
  1780. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1781. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1782. x.split(/\r\n|\n/).filter(user => "" !== user)
  1783. ),
  1784. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1785. ;(userConfig.bannedUsers = x),
  1786. GM.setValue("FYC_NG_USERS", x.join("\n"))
  1787. })
  1788. ),
  1789. simplifyChatFieldInputChange$.pipe(
  1790. (0, external_rxjs_operators_namespaceObject.map)(
  1791. getInputChecked
  1792. ),
  1793. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1794. ;(userConfig.simplifyChatField = x),
  1795. GM.setValue("FYC_SIMPLE_CHAT_FIELD", x)
  1796. })
  1797. ),
  1798. createBanButtonInputChange$.pipe(
  1799. (0, external_rxjs_operators_namespaceObject.map)(
  1800. getInputChecked
  1801. ),
  1802. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1803. ;(userConfig.createBanButtons = x),
  1804. GM.setValue("FYC_NG_BUTTON", x)
  1805. })
  1806. ),
  1807. displayModeratorNameInputChange$.pipe(
  1808. (0, external_rxjs_operators_namespaceObject.map)(
  1809. getInputChecked
  1810. ),
  1811. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1812. ;(userConfig.displayModeratorName = x),
  1813. GM.setValue("FYC_DISPLAY_MODERATOR_NAME", x)
  1814. })
  1815. ),
  1816. createChatsInputChange$.pipe(
  1817. (0, external_rxjs_operators_namespaceObject.map)(
  1818. getInputChecked
  1819. ),
  1820. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1821. ;(userConfig.createChats = x),
  1822. GM.setValue("FYC_TOGGLE_CREATE_COMMENTS", x)
  1823. })
  1824. ),
  1825. textOnlyInputChange$.pipe(
  1826. (0, external_rxjs_operators_namespaceObject.map)(
  1827. getInputChecked
  1828. ),
  1829. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1830. ;(userConfig.textOnly = x), GM.setValue("FYC_TEXT_ONLY", x)
  1831. })
  1832. ),
  1833. useStepTimingInputChange$.pipe(
  1834. (0, external_rxjs_operators_namespaceObject.map)(
  1835. getInputChecked
  1836. ),
  1837. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1838. ;(userConfig.timingFunction = x
  1839. ? stepTiming(panelState.timingStepCount)
  1840. : "linear"),
  1841. GM.setValue(
  1842. "FYC_TIMING_FUNCTION",
  1843. userConfig.timingFunction
  1844. )
  1845. })
  1846. ),
  1847. timingStepCountInputChange$.pipe(
  1848. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1849. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1850. parseInt(x, 10)
  1851. ),
  1852. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1853. ;(panelState.timingStepCount = x),
  1854. (userConfig.timingFunction = stepTiming(x)),
  1855. GM.setValue(
  1856. "FYC_TIMING_FUNCTION",
  1857. userConfig.timingFunction
  1858. )
  1859. })
  1860. )
  1861. )
  1862. .pipe(
  1863. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  1864. flowChats
  1865. .filter(chat => !chat.animationEnded)
  1866. .forEach(chat => {
  1867. stylizeChat(chat, userConfig),
  1868. animateChat(chat, flowChats, mainState, userConfig)
  1869. })
  1870. })
  1871. )
  1872. .subscribe(),
  1873. {
  1874. view: () => {
  1875. return external_m_default()(
  1876. "div",
  1877. {
  1878. className: "fyc_panel",
  1879. style: {
  1880. visibility: state.showPanel ? "visible" : "hidden",
  1881. backgroundColor: "rgba(30,30,30,0.9)",
  1882. zIndex: 5,
  1883. display: "flex",
  1884. position: "absolute",
  1885. bottom: "40px",
  1886. right: "0px",
  1887. padding: "6px",
  1888. color: "#fff",
  1889. fontSize: "14px",
  1890. width: "648px",
  1891. border: "solid 1px #666",
  1892. },
  1893. },
  1894. [
  1895. external_m_default()("div", { style: panelBoxStyle }, [
  1896. settingRow(getLang().language, [
  1897. external_m_default()(
  1898. "select",
  1899. {
  1900. style: { width: "60%" },
  1901. selectedIndex: langOptions.findIndex(
  1902. x => x[0] === userConfig.lang
  1903. ),
  1904. onchange: lib(langSelectChange$),
  1905. },
  1906. langOptions.map(x => settingPanel_option(...x))
  1907. ),
  1908. ]),
  1909. settingRow(getLang().font, [
  1910. external_m_default()(
  1911. "select",
  1912. {
  1913. style: { width: "60%" },
  1914. selectedIndex: fontOptions.findIndex(
  1915. x => x[0] === userConfig.font
  1916. ),
  1917. onchange: lib(fontSelectChange$),
  1918. },
  1919. fontOptions.map(x =>
  1920. settingPanel_option(
  1921. x[0],
  1922. "FYC_JA" === userConfig.lang ? x[2] : x[1]
  1923. )
  1924. )
  1925. ),
  1926. ]),
  1927. settingRow(getLang().color, [
  1928. textColorRow(
  1929. userConfig.color,
  1930. exampleTextStyle(),
  1931. lib(colorInputInput$)
  1932. ),
  1933. ]),
  1934. settingRow(getLang().ownerColor, [
  1935. textColorRow(
  1936. userConfig.ownerColor,
  1937. exampleTextStyle(),
  1938. lib(colorOwnerInputInput$)
  1939. ),
  1940. ]),
  1941. settingRow(getLang().moderatorColor, [
  1942. textColorRow(
  1943. userConfig.moderatorColor,
  1944. exampleTextStyle(),
  1945. lib(colorModeratorInputInput$)
  1946. ),
  1947. ]),
  1948. settingRow(getLang().memberColor, [
  1949. textColorRow(
  1950. userConfig.memberColor,
  1951. exampleTextStyle(),
  1952. lib(colorMemberInputInput$)
  1953. ),
  1954. ]),
  1955. external_m_default()(
  1956. "div",
  1957. { style: { textAlign: "right", margin: "3px 6px" } },
  1958. external_m_default()(
  1959. "a",
  1960. {
  1961. style: { color: "white" },
  1962. href:
  1963. "https://greasyfork.org/en/scripts/411442-flow-youtube-chat/feedback",
  1964. target: "_blank",
  1965. },
  1966. getLang().feedback
  1967. )
  1968. ),
  1969. ]),
  1970. external_m_default()("div", { style: panelBoxStyle }, [
  1971. settingRow(getLang().chatOpacity, [
  1972. rangeRow(
  1973. 0,
  1974. 1,
  1975. 0.05,
  1976. userConfig.chatOpacity,
  1977. lib(chatOpacityInputInput$)
  1978. ),
  1979. ]),
  1980. settingRow(getLang().fontSize, [
  1981. rangeRow(
  1982. 0.1,
  1983. 2,
  1984. 0.1,
  1985. userConfig.fontSize,
  1986. lib(fontSizeInputInput$)
  1987. ),
  1988. ]),
  1989. settingRow(getLang().fontWeight, [
  1990. rangeRow(
  1991. 10,
  1992. 1e3,
  1993. 10,
  1994. userConfig.fontWeight,
  1995. lib(fontWeightInputInput$)
  1996. ),
  1997. ]),
  1998. settingRow(getLang().shadowFontWeight, [
  1999. rangeRow(
  2000. 0,
  2001. 3,
  2002. 0.1,
  2003. userConfig.shadowFontWeight,
  2004. lib(shadowFontWeightInputInput$)
  2005. ),
  2006. ]),
  2007. settingRow(getLang().flowSpeed, [
  2008. rangeRow(
  2009. 1,
  2010. 50,
  2011. 1,
  2012. userConfig.flowSpeed,
  2013. lib(flowSpeedInputInput$)
  2014. ),
  2015. ]),
  2016. settingRow(getLang().maxChatCount, [
  2017. rangeRow(
  2018. 5,
  2019. 200,
  2020. 5,
  2021. userConfig.maxChatCount,
  2022. lib(maxChatCountInputInput$)
  2023. ),
  2024. ]),
  2025. settingRow(getLang().maxChatLength, [
  2026. rangeRow(
  2027. 5,
  2028. 200,
  2029. 5,
  2030. userConfig.maxChatLength,
  2031. lib(maxChatLengthInputInput$)
  2032. ),
  2033. ]),
  2034. settingRow(getLang().laneCount, [
  2035. rangeRow(
  2036. 1,
  2037. 20,
  2038. 1,
  2039. userConfig.laneCount,
  2040. lib(laneCountInputInput$)
  2041. ),
  2042. ]),
  2043. ]),
  2044. external_m_default()("div", { style: panelBoxStyle }, [
  2045. ((labels = [
  2046. getLang().bannedWords,
  2047. getLang().bannedWordRegexs,
  2048. getLang().bannedUsers,
  2049. ]),
  2050. (tabs = [
  2051. [
  2052. external_m_default()(
  2053. "textarea",
  2054. {
  2055. rows: 4,
  2056. style: textAreaStyle,
  2057. onchange: lib(bannedWordsTextAreaChange$),
  2058. },
  2059. userConfig.bannedWords.join("\n")
  2060. ),
  2061. ],
  2062. [
  2063. external_m_default()(
  2064. "span",
  2065. panelState.bannedWordRegexsValid
  2066. ? ""
  2067. : `${getLang().error}: ${
  2068. panelState.bannedWordRegexsError
  2069. }`
  2070. ),
  2071. external_m_default()(
  2072. "textarea",
  2073. {
  2074. rows: 4,
  2075. style: textAreaStyle,
  2076. onchange: lib(bannedWordRegexsTextAreaChange$),
  2077. },
  2078. panelState.bannedWordRegexs.join("\n")
  2079. ),
  2080. ],
  2081. [
  2082. external_m_default()(
  2083. "textarea",
  2084. {
  2085. rows: 4,
  2086. style: textAreaStyle,
  2087. onchange: lib(bannedUsersTextAreaChange$),
  2088. },
  2089. userConfig.bannedUsers.join("\n")
  2090. ),
  2091. ],
  2092. ]),
  2093. (currentTab = panelState.currentBanTab),
  2094. (onchange = lib(banTabChange$)),
  2095. external_m_default()("div", [
  2096. external_m_default()(
  2097. "select",
  2098. {
  2099. style: { width: "100%" },
  2100. selectedIndex: currentTab,
  2101. onchange,
  2102. },
  2103. labels.map((x, i) =>
  2104. settingPanel_option(i.toString(), x)
  2105. )
  2106. ),
  2107. ...tabs.map((x, i) =>
  2108. external_m_default()(
  2109. "div",
  2110. {
  2111. style: {
  2112. display: i === currentTab ? "block" : "none",
  2113. },
  2114. },
  2115. x
  2116. )
  2117. ),
  2118. ])),
  2119. external_m_default()(
  2120. "fieldset",
  2121. { style: fieldSetStyle },
  2122. [
  2123. external_m_default()("legend", getLang().chatField),
  2124. checkboxRow(
  2125. getLang().simplifyChatField,
  2126. userConfig.simplifyChatField,
  2127. lib(simplifyChatFieldInputChange$)
  2128. ),
  2129. checkboxRow(
  2130. getLang().createBanButton,
  2131. userConfig.createBanButtons,
  2132. lib(createBanButtonInputChange$)
  2133. ),
  2134. ]
  2135. ),
  2136. external_m_default()(
  2137. "fieldset",
  2138. { style: fieldSetStyle },
  2139. [
  2140. external_m_default()("legend", getLang().video),
  2141. checkboxRow(
  2142. getLang().displayModeratorName,
  2143. userConfig.displayModeratorName,
  2144. lib(displayModeratorNameInputChange$)
  2145. ),
  2146. checkboxRow(
  2147. getLang().createChats,
  2148. userConfig.createChats,
  2149. lib(createChatsInputChange$)
  2150. ),
  2151. checkboxRow(
  2152. getLang().textOnly,
  2153. userConfig.textOnly,
  2154. lib(textOnlyInputChange$)
  2155. ),
  2156. checkboxRow(
  2157. getLang().useStepTiming,
  2158. useStepTiming(),
  2159. lib(useStepTimingInputChange$)
  2160. ),
  2161. external_m_default()(
  2162. "div",
  2163. {
  2164. style: {
  2165. display: useStepTiming() ? "block" : "none",
  2166. },
  2167. },
  2168. settingRow(getLang().timingStepCount, [
  2169. rangeRow(
  2170. 1,
  2171. 400,
  2172. 1,
  2173. panelState.timingStepCount,
  2174. lib(timingStepCountInputChange$)
  2175. ),
  2176. ])
  2177. ),
  2178. ]
  2179. ),
  2180. ]),
  2181. ]
  2182. )
  2183. var labels, tabs, currentTab, onchange
  2184. },
  2185. }
  2186. )
  2187. },
  2188. settingComponent = (flowChats, recreateCss, mainState, userConfig) => {
  2189. const state = { showPanel: !1 },
  2190. panel = settingPanel(flowChats, 0, mainState, state, userConfig),
  2191. toggleButton = ((state, userConfig) => {
  2192. const click$ = new external_rxjs_namespaceObject.Subject()
  2193. return (
  2194. click$
  2195. .pipe(
  2196. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2197. state.showPanel = !state.showPanel
  2198. })
  2199. )
  2200. .subscribe(),
  2201. {
  2202. view: () =>
  2203. external_m_default()(
  2204. "button",
  2205. {
  2206. className: "fyc_button",
  2207. style: {
  2208. background: "rgba(0,0,0,0)",
  2209. marginLeft: "10px",
  2210. whiteSpace: "nowrap",
  2211. },
  2212. onclick: lib(click$),
  2213. },
  2214. [
  2215. external_m_default()(
  2216. "svg",
  2217. {
  2218. preserveAspectRatio: "xMidYMid meet",
  2219. viewBox: "0 0 640 640",
  2220. width: "15",
  2221. height: "15",
  2222. style: { position: "relative", top: "1px" },
  2223. },
  2224. [
  2225. external_m_default()(
  2226. "defs",
  2227. external_m_default()("path", {
  2228. id: "d1TbzTC1zI",
  2229. d:
  2230. "M135.38 58.17L136.02 58.22L136.65 58.29L137.3 58.39L137.95 58.52L138.61 58.66L139.27 58.83L139.94 59.01L140.61 59.22L141.29 59.45L141.98 59.7L142.66 59.96L143.35 60.25L144.05 60.55L144.74 60.87L145.44 61.2L146.15 61.55L146.85 61.92L147.56 62.3L148.27 62.69L148.97 63.1L149.69 63.52L150.4 63.95L151.11 64.4L196.98 91.31L197.88 90.81L206.8 86.34L215.92 82.22L216.84 81.84L216.84 224.11L214.42 226.66L210.89 230.67L207.51 234.82L204.29 239.1L201.23 243.51L198.33 248.04L195.6 252.69L193.05 257.45L190.68 262.32L188.49 267.29L186.49 272.36L184.67 277.53L183.06 282.79L181.65 288.14L180.44 293.57L179.44 299.08L178.66 304.65L178.09 310.3L177.75 316.01L177.63 321.78L177.75 327.56L178.09 333.27L178.66 338.91L179.44 344.49L180.44 350L181.65 355.43L183.06 360.77L184.67 366.04L186.49 371.2L188.49 376.28L190.68 381.25L193.05 386.12L195.6 390.88L198.33 395.53L201.23 400.06L204.29 404.47L207.51 408.75L210.89 412.89L214.42 416.91L218.1 420.78L221.92 424.51L225.88 428.08L229.97 431.51L234.2 434.77L238.54 437.87L243.01 440.81L247.6 443.57L252.3 446.16L257.1 448.56L262.01 450.78L267.02 452.81L272.12 454.65L277.31 456.28L282.59 457.72L287.95 458.94L293.38 459.95L298.89 460.75L304.46 461.32L310.09 461.67L315.79 461.78L321.48 461.67L327.12 461.32L332.69 460.75L338.2 459.95L343.63 458.94L348.99 457.72L354.27 456.28L359.46 454.65L364.56 452.81L369.57 450.78L374.48 448.56L379.28 446.16L383.98 443.57L388.57 440.81L393.03 437.87L397.38 434.77L401.61 431.51L405.7 428.08L409.66 424.51L413.48 420.78L417.16 416.91L420.69 412.89L424.07 408.75L427.29 404.47L430.35 400.06L433.25 395.53L435.97 390.88L438.53 386.12L440.9 381.25L443.09 376.28L445.09 371.2L446.9 366.04L448.52 360.77L449.93 355.43L451.14 350L452.14 344.49L452.92 338.91L453.49 333.27L453.83 327.56L453.95 321.78L453.83 316.01L453.77 314.95L487.06 314.95L627.33 378.59L627.31 378.6L626.83 379L626.32 379.38L625.8 379.75L625.25 380.11L624.68 380.47L624.1 380.81L623.5 381.15L622.87 381.48L622.24 381.8L621.58 382.11L620.91 382.42L620.22 382.72L619.52 383.01L618.81 383.31L618.08 383.59L617.34 383.87L616.58 384.15L615.82 384.43L615.04 384.7L614.26 384.98L613.46 385.25L612.66 385.52L611.84 385.78L560.61 399.62L559.29 403.96L555.92 413.56L552.21 422.99L548.14 432.23L543.73 441.27L543.23 442.18L569.79 488.66L570.23 489.38L570.65 490.1L571.07 490.82L571.47 491.54L571.86 492.26L572.24 492.98L572.6 493.69L572.94 494.4L573.27 495.11L573.59 495.82L573.89 496.52L574.17 497.22L574.43 497.92L574.67 498.61L574.9 499.3L575.1 499.98L575.29 500.65L575.45 501.33L575.59 501.99L575.71 502.65L575.81 503.31L575.89 503.96L575.94 504.6L575.96 505.23L575.97 505.85L575.94 506.47L575.89 507.08L575.81 507.68L575.71 508.27L575.58 508.86L575.42 509.43L575.22 510L575 510.55L574.75 511.09L574.47 511.63L574.16 512.15L573.81 512.66L573.44 513.16L573.03 513.64L572.58 514.12L505.59 582L505.12 582.45L504.65 582.86L504.16 583.24L503.67 583.58L503.16 583.89L502.65 584.16L502.12 584.4L501.59 584.61L501.05 584.79L500.5 584.93L499.94 585.05L499.38 585.14L498.8 585.2L498.22 585.23L497.63 585.24L497.03 585.22L496.42 585.18L495.8 585.11L495.18 585.02L494.55 584.9L493.91 584.77L493.26 584.61L492.61 584.44L491.95 584.24L491.28 584.03L490.6 583.8L489.92 583.55L489.23 583.29L488.54 583.01L487.83 582.71L487.13 582.41L486.41 582.09L485.69 581.76L484.96 581.42L484.23 581.06L483.49 580.7L482.74 580.33L481.99 579.95L481.23 579.56L480.47 579.17L434.6 552.26L433.7 552.76L424.78 557.23L415.66 561.35L406.36 565.12L396.89 568.53L392.6 569.87L378.95 621.78L378.68 622.61L378.42 623.42L378.15 624.23L377.88 625.03L377.61 625.81L377.34 626.59L377.06 627.35L376.78 628.1L376.5 628.84L376.21 629.57L375.92 630.28L375.62 630.97L375.32 631.65L375.01 632.32L374.69 632.96L374.37 633.59L374.04 634.2L373.7 634.8L373.35 635.37L372.99 635.92L372.63 636.46L372.25 636.97L371.86 637.46L371.46 637.92L371.05 638.37L370.63 638.79L370.19 639.18L369.74 639.55L369.28 639.89L368.8 640.21L368.31 640.5L367.81 640.76L367.29 641L366.75 641.2L366.19 641.38L365.62 641.52L365.03 641.64L364.43 641.72L363.8 641.77L363.16 641.78L268.42 641.78L267.78 641.77L267.14 641.72L266.53 641.64L265.93 641.52L265.34 641.38L264.77 641.2L264.22 641L263.68 640.76L263.15 640.5L262.63 640.21L262.13 639.89L261.64 639.55L261.17 639.18L260.71 638.79L260.26 638.37L259.83 637.92L259.4 637.46L258.99 636.97L258.59 636.46L258.21 635.92L257.83 635.37L257.47 634.8L257.11 634.2L256.77 633.59L256.44 632.96L256.12 632.32L255.81 631.65L255.51 630.97L255.22 630.28L254.94 629.57L254.67 628.84L254.41 628.1L254.16 627.35L253.91 626.59L253.68 625.81L253.45 625.03L253.24 624.23L253.03 623.42L252.82 622.61L252.63 621.78L238.98 569.87L234.69 568.53L225.22 565.12L215.92 561.35L206.8 557.23L197.88 552.76L196.8 552.17L151.11 578.98L150.4 579.42L149.69 579.86L148.97 580.28L148.27 580.68L147.56 581.08L146.85 581.46L146.15 581.83L145.44 582.18L144.74 582.51L144.05 582.83L143.35 583.13L142.66 583.42L141.98 583.68L141.29 583.93L140.61 584.16L139.94 584.36L139.27 584.55L138.61 584.72L137.95 584.86L137.3 584.98L136.65 585.08L136.02 585.16L135.38 585.21L134.76 585.24L134.14 585.24L133.53 585.21L132.93 585.16L132.34 585.08L131.75 584.98L131.18 584.84L130.61 584.68L130.05 584.49L129.51 584.26L128.97 584.01L128.45 583.73L127.93 583.41L127.43 583.06L126.94 582.68L126.46 582.26L125.99 581.81L59 513.93L58.55 513.45L58.15 512.97L57.78 512.48L57.44 511.98L57.14 511.46L56.87 510.94L56.63 510.41L56.42 509.87L56.25 509.33L56.1 508.77L55.99 508.2L55.9 507.63L55.84 507.05L55.81 506.45L55.8 505.85L55.82 505.25L55.86 504.63L55.93 504.01L56.02 503.37L56.13 502.73L56.27 502.09L56.42 501.43L56.59 500.77L56.78 500.1L57 499.42L57.22 498.74L57.47 498.05L57.73 497.35L58 496.64L58.29 495.93L58.59 495.21L58.91 494.49L59.24 493.76L59.57 493.02L59.92 492.28L60.28 491.53L60.65 490.77L61.02 490.01L61.4 489.24L61.79 488.47L88.29 442.09L87.85 441.27L83.44 432.23L79.37 422.99L75.65 413.56L72.29 403.96L70.96 399.62L19.74 385.78L18.92 385.52L18.12 385.25L17.32 384.98L16.54 384.7L15.76 384.43L15 384.15L14.24 383.87L13.5 383.59L12.77 383.31L12.06 383.01L11.36 382.72L10.67 382.42L10 382.11L9.34 381.8L8.7 381.48L8.08 381.15L7.48 380.81L6.9 380.47L6.33 380.11L5.78 379.75L5.26 379.38L4.75 379L4.27 378.6L3.81 378.2L3.37 377.78L2.96 377.35L2.57 376.91L2.2 376.46L1.87 375.99L1.55 375.51L1.27 375.01L1.01 374.5L0.78 373.97L0.57 373.42L0.4 372.86L0.26 372.28L0.15 371.68L0.07 371.07L0.02 370.44L0 369.78L0 273.78L0.02 273.13L0.07 272.49L0.15 271.87L0.26 271.26L0.4 270.67L0.57 270.09L0.78 269.52L1.01 268.98L1.27 268.44L1.55 267.92L1.87 267.41L2.2 266.92L2.57 266.44L2.96 265.97L3.37 265.52L3.81 265.07L4.27 264.65L4.75 264.23L5.26 263.83L5.78 263.43L6.33 263.05L6.9 262.68L7.48 262.33L8.08 261.98L8.7 261.64L9.34 261.32L10 261L10.67 260.7L11.36 260.41L12.06 260.12L12.77 259.85L13.5 259.58L14.24 259.33L15 259.08L15.76 258.84L16.54 258.62L17.32 258.4L18.12 258.18L18.92 257.98L19.74 257.78L70.96 243.95L72.29 239.6L75.65 230L79.37 220.58L83.44 211.34L87.85 202.3L88.35 201.39L61.79 154.91L61.4 154.13L61.02 153.37L60.65 152.61L60.28 151.85L59.92 151.1L59.57 150.36L59.24 149.62L58.91 148.89L58.59 148.16L58.29 147.45L58 146.73L57.73 146.03L57.47 145.33L57.22 144.64L57 143.96L56.78 143.28L56.59 142.61L56.42 141.95L56.27 141.29L56.13 140.64L56.02 140L55.93 139.37L55.86 138.75L55.82 138.13L55.8 137.52L55.81 136.92L55.84 136.33L55.9 135.75L55.99 135.17L56.1 134.61L56.25 134.05L56.42 133.5L56.63 132.96L56.87 132.43L57.14 131.91L57.44 131.4L57.78 130.9L58.15 130.41L58.55 129.92L59 129.45L125.99 61.57L126.46 61.12L126.94 60.7L127.43 60.32L127.93 59.97L128.45 59.65L128.97 59.37L129.51 59.11L130.05 58.89L130.61 58.7L131.18 58.53L131.75 58.4L132.34 58.29L132.93 58.21L133.53 58.16L134.14 58.14L134.76 58.14L135.38 58.17ZM576.75 2.01L579.53 2.29L582.28 2.69L584.99 3.18L587.66 3.79L590.29 4.49L592.88 5.3L595.42 6.2L597.92 7.2L600.37 8.29L602.76 9.47L605.11 10.75L607.39 12.11L609.62 13.55L611.79 15.08L613.9 16.68L615.94 18.37L617.91 20.13L619.82 21.96L621.65 23.87L623.41 25.84L625.1 27.89L626.71 29.99L628.23 32.16L629.68 34.39L631.04 36.68L632.31 39.02L633.49 41.42L634.59 43.86L635.58 46.36L636.49 48.91L637.29 51.49L638 54.13L638.6 56.8L639.1 59.51L639.49 62.25L639.77 65.03L639.94 67.84L640 70.68L640 208.48L639.94 211.32L639.77 214.13L639.49 216.91L639.1 219.66L638.6 222.37L638 225.04L637.29 227.67L636.49 230.26L635.58 232.8L634.59 235.3L633.49 237.75L632.31 240.14L631.04 242.49L629.68 244.77L628.23 247L626.71 249.17L625.1 251.28L623.41 253.32L621.65 255.29L619.82 257.2L617.91 259.03L615.94 260.79L613.9 262.48L611.79 264.09L609.62 265.61L607.39 267.06L605.11 268.42L602.76 269.69L601.78 270.18L623.59 340.98L481.84 277.38L326.79 277.38L323.95 277.32L321.14 277.15L318.36 276.87L315.62 276.48L312.91 275.98L310.24 275.38L307.6 274.67L305.02 273.87L302.47 272.96L299.97 271.96L297.53 270.87L295.13 269.69L292.79 268.42L290.5 267.06L288.27 265.61L286.1 264.09L284 262.48L281.95 260.79L279.98 259.03L278.07 257.2L276.24 255.29L274.48 253.32L272.8 251.28L271.19 249.17L269.66 247L268.22 244.77L266.86 242.49L265.59 240.14L264.4 237.75L263.31 235.3L262.31 232.8L261.41 230.26L260.6 227.67L259.9 225.04L259.29 222.37L258.8 219.66L258.41 216.91L258.12 214.13L257.95 211.32L257.89 208.48L257.89 70.68L257.95 67.84L258.12 65.03L258.41 62.25L258.8 59.51L259.29 56.8L259.9 54.13L260.6 51.49L261.41 48.91L262.31 46.36L263.31 43.86L264.4 41.42L265.59 39.02L266.86 36.68L268.22 34.39L269.66 32.16L271.19 29.99L272.8 27.89L274.48 25.84L276.24 23.87L278.07 21.96L279.98 20.13L281.95 18.37L284 16.68L286.1 15.08L288.27 13.55L290.5 12.11L292.79 10.75L295.13 9.47L297.53 8.29L299.97 7.2L302.47 6.2L305.02 5.3L307.6 4.49L310.24 3.79L312.91 3.18L315.62 2.69L318.36 2.29L321.14 2.01L323.95 1.84L326.79 1.78L571.1 1.78L573.94 1.84L576.75 2.01Z",
  2231. })
  2232. ),
  2233. external_m_default()("use", {
  2234. "xlink:href": "#d1TbzTC1zI",
  2235. opacity: "1",
  2236. fill: "var(--iron-icon-fill-color, currentcolor)",
  2237. "fill-opacity": "1",
  2238. }),
  2239. ]
  2240. ),
  2241. external_m_default()(
  2242. "span",
  2243. {
  2244. style: {
  2245. position: "relative",
  2246. top: "-2px",
  2247. marginLeft: "8px,",
  2248. },
  2249. },
  2250. "FYC_JA" === userConfig.lang ? "設定" : "Settings"
  2251. ),
  2252. ]
  2253. ),
  2254. }
  2255. )
  2256. })(state, userConfig)
  2257. return {
  2258. view: () =>
  2259. external_m_default()("span", { style: { display: "contents" } }, [
  2260. external_m_default()(panel),
  2261. external_m_default()(toggleButton),
  2262. ]),
  2263. }
  2264. },
  2265. videoToggleStream = video =>
  2266. (0, external_rxjs_namespaceObject.merge)(
  2267. (0, external_rxjs_namespaceObject.fromEvent)(video, "playing").pipe(
  2268. (0, external_rxjs_operators_namespaceObject.mapTo)(!0)
  2269. ),
  2270. (0, external_rxjs_namespaceObject.fromEvent)(video, "waiting").pipe(
  2271. (0, external_rxjs_operators_namespaceObject.mapTo)(!1)
  2272. ),
  2273. (0, external_rxjs_namespaceObject.fromEvent)(video, "pause").pipe(
  2274. (0, external_rxjs_operators_namespaceObject.mapTo)(!1)
  2275. )
  2276. ),
  2277. requirementMet = () =>
  2278. livePage_getChatFrame() &&
  2279. livePage_getChatField() &&
  2280. livePage_getPlayer(),
  2281. initialize = async () => {
  2282. logFyc("Script started")
  2283. const userConfig = await (async () => ({
  2284. lang: tapNonNull(await GM.getValue("FYC_LANG", "FYC_EN")),
  2285. font: tapNonNull(await GM.getValue("FYC_FONT", "")),
  2286. chatOpacity: tapNonNull(await GM.getValue("FYC_OPACITY", 1)),
  2287. color: tapNonNull(await GM.getValue("FYC_COLOR", "#FFFFFF")),
  2288. ownerColor: tapNonNull(
  2289. await GM.getValue("FYC_COLOR_OWNER", "#ffd600")
  2290. ),
  2291. moderatorColor: tapNonNull(
  2292. await GM.getValue("FYC_COLOR_MODERATOR", "#5e84f1")
  2293. ),
  2294. memberColor: tapNonNull(
  2295. await GM.getValue("FYC_COLOR_MEMBER", "#2ba640")
  2296. ),
  2297. fontSize: tapNonNull(await GM.getValue("FYC_SIZE", 1)),
  2298. fontWeight: tapNonNull(await GM.getValue("FYC_WEIGHT", 730)),
  2299. shadowFontWeight: tapNonNull(
  2300. await GM.getValue("FYC_WEIGHT_SHADOW", 1)
  2301. ),
  2302. maxChatCount: tapNonNull(await GM.getValue("FYC_LIMIT", 25)),
  2303. flowSpeed: tapNonNull(await GM.getValue("FYC_SPEED", 18)),
  2304. maxChatLength: tapNonNull(await GM.getValue("FYC_MAX", 100)),
  2305. laneCount: tapNonNull(await GM.getValue("FYC_LANE_DIV", 12)),
  2306. bannedWords: tapNonNull(await GM.getValue("FYC_NG_WORDS", ""))
  2307. .split(/\r\n|\n/)
  2308. .filter(x => "" !== x),
  2309. bannedWordRegexs: tapNonNull(
  2310. await GM.getValue("FYC_NG_REG_WORDS", "")
  2311. )
  2312. .split(/\r\n|\n/)
  2313. .filter(x => "" !== x),
  2314. bannedUsers: tapNonNull(await GM.getValue("FYC_NG_USERS", ""))
  2315. .split(/\r\n|\n/)
  2316. .filter(x => "" !== x),
  2317. createChats: tapNonNull(
  2318. await GM.getValue("FYC_TOGGLE_CREATE_COMMENTS", !0)
  2319. ),
  2320. displayChats: tapNonNull(
  2321. await GM.getValue("FYC_DISPLAY_COMMENTS", !0)
  2322. ),
  2323. createBanButtons: tapNonNull(
  2324. await GM.getValue("FYC_NG_BUTTON", !0)
  2325. ),
  2326. simplifyChatField: tapNonNull(
  2327. await GM.getValue("FYC_SIMPLE_CHAT_FIELD", !1)
  2328. ),
  2329. displayModeratorName: tapNonNull(
  2330. await GM.getValue("FYC_DISPLAY_MODERATOR_NAME", !0)
  2331. ),
  2332. textOnly: tapNonNull(await GM.getValue("FYC_TEXT_ONLY", !1)),
  2333. timingFunction: tapNonNull(
  2334. await GM.getValue("FYC_TIMING_FUNCTION", "linear")
  2335. ),
  2336. }))(),
  2337. reinitSubject = new external_rxjs_namespaceObject.Subject(),
  2338. reinitialize = lib(reinitSubject),
  2339. chatScrn = (() => {
  2340. const element = document.createElement("div")
  2341. return (
  2342. element.classList.add("fyc_chat_screen"),
  2343. (element.style.pointerEvents = "none"),
  2344. (element.style.zIndex = "30"),
  2345. element
  2346. )
  2347. })(),
  2348. flowChats = []
  2349. let chatField, video, player
  2350. const mainState = { videoPlaying: !1, playerRect: new DOMRect() }
  2351. let storedHref = window.location.href
  2352. new MutationObserver(async () => {
  2353. storedHref !== window.location.href &&
  2354. ((storedHref = window.location.href),
  2355. logFyc("URL Changed", storedHref),
  2356. await reinitialize())
  2357. }).observe(document, { childList: !0, subtree: !0 })
  2358. const chatObserver = chatFieldObserver(
  2359. chatScrn,
  2360. flowChats,
  2361. mainState,
  2362. userConfig
  2363. ),
  2364. playerResizeSubject = new external_rxjs_namespaceObject.Subject(),
  2365. playerResizeObserver = new ResizeObserver(lib(playerResizeSubject)),
  2366. toggleChatBtn = ((flowChats, userConfig) => {
  2367. const click$ = new external_rxjs_namespaceObject.Subject()
  2368. click$
  2369. .pipe(
  2370. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2371. const newDisplay = !userConfig.displayChats
  2372. flowChats.forEach(x => {
  2373. x.element.style.visibility = newDisplay
  2374. ? "visible"
  2375. : "hidden"
  2376. }),
  2377. (userConfig.displayChats = newDisplay),
  2378. GM.setValue("FYC_DISPLAY_COMMENTS", newDisplay)
  2379. })
  2380. )
  2381. .subscribe()
  2382. const label = () =>
  2383. "チャット" + (userConfig.displayChats ? "非表示" : "表示")
  2384. return {
  2385. view: () =>
  2386. external_m_default()(
  2387. "button",
  2388. {
  2389. className: ["ytp-button"].join(" "),
  2390. style: {
  2391. background: "none",
  2392. border: "none",
  2393. cursor: "pointer",
  2394. float: "left",
  2395. fontSize: "1em",
  2396. height: "4em",
  2397. outline: "none",
  2398. overflow: "visible",
  2399. padding: "0 0 0em",
  2400. position: "relative",
  2401. width: "3em",
  2402. },
  2403. type: "button",
  2404. "aria-label": label(),
  2405. title: label(),
  2406. onclick: lib(click$),
  2407. },
  2408. [
  2409. external_m_default()(
  2410. "svg",
  2411. { style: { width: "100%" }, viewBox: "0 0 36 36" },
  2412. [
  2413. external_m_default()("path", {
  2414. className: ["chat-button-path"].join(" "),
  2415. d:
  2416. "M 11 12 L 28 12 Q 29 12 29 13 L 29 22 Q 29 23 28 23 L 27 23 L 27 25 L 23 23 L 11 23 Q 10 23 10 22 L 10 13 Q 10 12 11 12 Z",
  2417. fill: "#fff",
  2418. "fill-opacity": userConfig.displayChats ? "1" : "0",
  2419. stroke: "#fff",
  2420. "stroke-width": "2",
  2421. }),
  2422. ]
  2423. ),
  2424. ]
  2425. ),
  2426. }
  2427. })(flowChats, userConfig),
  2428. mountToggleChatBtn = componentMounter(
  2429. document.createElement("span"),
  2430. x => {
  2431. const parent = document.querySelector(".ytp-right-controls")
  2432. return (
  2433. parent && (parent.append(x), (x.style.display = "contents")),
  2434. Boolean(parent)
  2435. )
  2436. }
  2437. ),
  2438. settingComp = settingComponent(flowChats, 0, mainState, userConfig),
  2439. mountSettingComp = componentMounter(
  2440. document.createElement("span"),
  2441. x => {
  2442. const parent = document.querySelector(
  2443. "#menu-container .dropdown-trigger.style-scope.ytd-menu-renderer"
  2444. )
  2445. return (
  2446. parent &&
  2447. (parent.insertAdjacentElement("beforebegin", x),
  2448. (x.style.display = "contents")),
  2449. Boolean(parent)
  2450. )
  2451. }
  2452. )
  2453. external_log_default().debug("Append ToggleChatDisplayButton")
  2454. reinitSubject
  2455. .pipe(
  2456. (0, external_rxjs_operators_namespaceObject.observeOn)(
  2457. external_rxjs_namespaceObject.asyncScheduler
  2458. ),
  2459. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2460. (0, external_rxjs_namespaceObject.interval)(800).pipe(
  2461. (0, external_rxjs_operators_namespaceObject.startWith)(0),
  2462. (0, external_rxjs_operators_namespaceObject.map)(
  2463. requirementMet
  2464. ),
  2465. (0, external_rxjs_operators_namespaceObject.filter)(() => {
  2466. var _a, _b
  2467. const chatFieldDetached =
  2468. chatField &&
  2469. !(null ===
  2470. (_b =
  2471. null === (_a = livePage_getChatFrame()) ||
  2472. void 0 === _a
  2473. ? void 0
  2474. : _a.contentDocument) || void 0 === _b
  2475. ? void 0
  2476. : _b.contains(chatField)) &&
  2477. !document.contains(chatField),
  2478. logDetached = x => `${x} detached, will reload...`
  2479. chatFieldDetached &&
  2480. (logDetached("Chat field"), (chatField = void 0))
  2481. const videoDetached = video && !document.contains(video)
  2482. videoDetached &&
  2483. (logDetached("Video"),
  2484. (video = void 0),
  2485. (mainState.videoPlaying = !1))
  2486. const playerDetached = player && !document.contains(player)
  2487. playerDetached && (logDetached("Player"), (player = void 0))
  2488. const detached =
  2489. chatFieldDetached || videoDetached || playerDetached
  2490. return detached && reinitialize(), !detached
  2491. }),
  2492. (0, external_rxjs_operators_namespaceObject.startWith)(!1),
  2493. (0,
  2494. external_rxjs_operators_namespaceObject.distinctUntilChanged)(),
  2495. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2496. logFyc(
  2497. x
  2498. ? "Found the chat container and the player"
  2499. : "Waiting to load..."
  2500. )
  2501. ),
  2502. (0, external_rxjs_operators_namespaceObject.filter)(Boolean)
  2503. )
  2504. ),
  2505. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2506. logFyc("Wait for 2300ms...")
  2507. ),
  2508. (0, external_rxjs_operators_namespaceObject.delay)(2300),
  2509. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2510. logFyc("Initializing...")
  2511. ),
  2512. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2513. var _a
  2514. flowChats.splice(0, flowChats.length).forEach(chat => {
  2515. chat.element.remove()
  2516. }),
  2517. chatObserver.disconnect(),
  2518. (chatField = livePage_getChatField()),
  2519. chatField &&
  2520. chatObserver.observe(chatField, { childList: !0 }),
  2521. (video = livePage_getMainVideo()),
  2522. video &&
  2523. (external_log_default().debug("AppendChatScreen"),
  2524. (mainState.videoPlaying = !video.paused),
  2525. null === (_a = livePage_getPlayer()) ||
  2526. void 0 === _a ||
  2527. _a.insertAdjacentElement("afterbegin", chatScrn)),
  2528. playerResizeObserver.disconnect(),
  2529. (player = livePage_getPlayer()),
  2530. player && playerResizeObserver.observe(player),
  2531. mountToggleChatBtn(toggleChatBtn),
  2532. mountSettingComp(settingComp),
  2533. createScriptCss(),
  2534. (chatField && video && player) || reinitialize()
  2535. }),
  2536. (0, external_rxjs_operators_namespaceObject.switchMap)(
  2537. setChatFrameCss
  2538. ),
  2539. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2540. (0, external_rxjs_namespaceObject.merge)(
  2541. ...(video
  2542. ? [
  2543. videoToggleStream(video).pipe(
  2544. (0, external_rxjs_operators_namespaceObject.tap)(
  2545. playing => {
  2546. ;(mainState.videoPlaying = playing),
  2547. flowChats.forEach(chat => {
  2548. animateChat(
  2549. chat,
  2550. flowChats,
  2551. mainState,
  2552. userConfig
  2553. )
  2554. })
  2555. }
  2556. )
  2557. ),
  2558. ]
  2559. : []),
  2560. playerResizeSubject.pipe(
  2561. (0, external_rxjs_operators_namespaceObject.debounceTime)(
  2562. 800
  2563. ),
  2564. (0, external_rxjs_operators_namespaceObject.startWith)([]),
  2565. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2566. var _a
  2567. logFyc("Resize detected"),
  2568. (mainState.playerRect =
  2569. null !==
  2570. (_a =
  2571. null == player
  2572. ? void 0
  2573. : player.getBoundingClientRect()) &&
  2574. void 0 !== _a
  2575. ? _a
  2576. : new DOMRect()),
  2577. flowChats.forEach(chat => {
  2578. stylizeChat(chat, userConfig),
  2579. animateChat(chat, flowChats, mainState, userConfig)
  2580. })
  2581. })
  2582. )
  2583. )
  2584. ),
  2585. (0, external_rxjs_operators_namespaceObject.retryWhen)(x =>
  2586. x.pipe(
  2587. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2588. logFyc("Errored:")
  2589. ),
  2590. (0, external_rxjs_operators_namespaceObject.tap)(
  2591. external_log_default().warn
  2592. )
  2593. )
  2594. )
  2595. )
  2596. .subscribe(),
  2597. await reinitialize()
  2598. }
  2599. ;(async () => {
  2600. external_log_namespaceObject.setLevel("info")
  2601. try {
  2602. await initialize()
  2603. } catch (error) {
  2604. external_log_namespaceObject.error(error)
  2605. }
  2606. })()
  2607. })()
  2608. })()