Flow Youtube Chat

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

目前为 2021-02-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Flow Youtube Chat
  3. // @version 1.13.7
  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. const assert_lib = __webpack_require__(494).assert,
  803. tapNonNull = x => (assert_lib(null != x), x),
  804. livePage_getPlayer = () => {
  805. var _a
  806. return null !== (_a = document.querySelector("#movie_player")) &&
  807. void 0 !== _a
  808. ? _a
  809. : void 0
  810. },
  811. livePage_getMainVideo = () => {
  812. var _a
  813. return null !==
  814. (_a = document.querySelector(
  815. "video.video-stream.html5-main-video"
  816. )) && void 0 !== _a
  817. ? _a
  818. : void 0
  819. },
  820. livePage_getChatFrame = () => {
  821. var _a
  822. return null !== (_a = document.querySelector("#chatframe")) &&
  823. void 0 !== _a
  824. ? _a
  825. : void 0
  826. },
  827. livePage_getChatField = () => {
  828. var _a, _b, _c
  829. return null !==
  830. (_c = (null !==
  831. (_b =
  832. null === (_a = document.querySelector("#chatframe")) ||
  833. void 0 === _a
  834. ? void 0
  835. : _a.contentDocument) && void 0 !== _b
  836. ? _b
  837. : document
  838. ).querySelector(
  839. "#items.style-scope.yt-live-chat-item-list-renderer"
  840. )) && void 0 !== _c
  841. ? _c
  842. : void 0
  843. },
  844. getChatFontSize = userConfig => {
  845. var _a, _b
  846. return (
  847. Math.round(
  848. (userConfig.fontSize - 0.2) *
  849. ((null !==
  850. (_b =
  851. null === (_a = livePage_getMainVideo()) || void 0 === _a
  852. ? void 0
  853. : _a.clientHeight) && void 0 !== _b
  854. ? _b
  855. : 0) /
  856. userConfig.laneCount) *
  857. 100
  858. ) / 100
  859. )
  860. },
  861. parseMessage = (lengthBefore, message, userConfig) => {
  862. const { maxChatLength } = userConfig
  863. let html = "",
  864. length = lengthBefore
  865. return (
  866. message.innerHTML.split(/(?=<img)|">/g).some(part => {
  867. if (part.match(/^<img/)) {
  868. if (!userConfig.textOnly) {
  869. const src = part.match(/src="(\\.|[^"\\])*"/g),
  870. size = getChatFontSize(userConfig)
  871. ;(html += `<img ${src} height="${size}px">`), (length += 1)
  872. }
  873. } else
  874. (html +=
  875. part.length >= maxChatLength
  876. ? part.substr(0, maxChatLength)
  877. : part),
  878. (length += part.length)
  879. return length >= maxChatLength
  880. }),
  881. { html, length }
  882. )
  883. },
  884. external_m_namespaceObject = m
  885. var external_m_default = __webpack_require__.n(external_m_namespaceObject)
  886. const external_Swal_namespaceObject = Swal
  887. var external_Swal_default = __webpack_require__.n(
  888. external_Swal_namespaceObject
  889. )
  890. const logFyc = (...x) => external_log_default().info(`【FYC ${x}`),
  891. createBanButton = (chat, id, userConfig) => {
  892. var _a, _b
  893. if (chat.children.namedItem("card")) return
  894. const button = document.createElement("button")
  895. button.classList.add(
  896. "style-scope",
  897. "yt-icon-button",
  898. "fyc_button",
  899. "fyc_ngbutton"
  900. ),
  901. (button.style.padding = "0px"),
  902. (button.style.width = "20px"),
  903. (button.style.height = "20px"),
  904. (button.style.fill = "#fff"),
  905. button.setAttribute("aria-label", "NGに入れる"),
  906. (button.innerHTML =
  907. '<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>'),
  908. (button.onclick = () => {
  909. logFyc(`Added to Banned Users: ${id}`),
  910. userConfig.bannedUsers.push(id),
  911. GM.setValue("FYC_NG_USERS", userConfig.bannedUsers.join("\n")),
  912. external_m_default().redraw(),
  913. (chat.style.display = "none"),
  914. external_Swal_default()
  915. .mixin({
  916. toast: !0,
  917. position: "bottom-left",
  918. timer: 2500,
  919. timerProgressBar: !0,
  920. showConfirmButton: !1,
  921. didOpen: toast => {
  922. toast.addEventListener(
  923. "mouseenter",
  924. external_Swal_default().stopTimer
  925. ),
  926. toast.addEventListener(
  927. "mouseleave",
  928. external_Swal_default().resumeTimer
  929. )
  930. },
  931. })
  932. .fire({ title: `Added Banned User: ${id}`, icon: "success" })
  933. }),
  934. external_log_default().debug("AppendNgButton"),
  935. null ===
  936. (_b =
  937. null === (_a = chat.children.namedItem("content")) ||
  938. void 0 === _a
  939. ? void 0
  940. : _a.children.namedItem("message")) ||
  941. void 0 === _b ||
  942. _b.append(button)
  943. },
  944. setChatAnimation = flowChat => {
  945. const { style } = flowChat.element
  946. style.animationName = flowChat.animationEnded
  947. ? "nolane"
  948. : `lane${flowChat.lane}`
  949. },
  950. stylizeChat = (flowChat, mainState, userConfig) => {
  951. const fontSize = getChatFontSize(userConfig),
  952. offset = userConfig.shadowFontWeight,
  953. chatDuration = (userConfig => 96 / userConfig.flowSpeed)(
  954. userConfig
  955. ),
  956. { style } = flowChat.element
  957. ;(style.visibility = userConfig.displayChats ? "visible" : "hidden"),
  958. (style.color = flowChat.color),
  959. (style.fontSize = `${fontSize}px`),
  960. (style.fontWeight = userConfig.fontWeight.toString()),
  961. (style.fontFamily = userConfig.font),
  962. (style.opacity = userConfig.chatOpacity.toString()),
  963. (style.animationDuration = `${chatDuration}s`),
  964. (style.textShadow = `-${offset}px -${offset}px #000, ${offset}px -${offset}px #000, -${offset}px ${offset}px #000, ${offset}px ${offset}px #000`),
  965. (style.animationPlayState = mainState.videoPlaying
  966. ? "running"
  967. : "paused"),
  968. (style.animationTimingFunction = userConfig.timingFunction)
  969. },
  970. createChat = (chatData, flowChats, chatScrn, mainState, userConfig) => {
  971. let element
  972. const offScreenChatIndex = flowChats.findIndex(
  973. chat =>
  974. chat.animationEnded || flowChats.length >= userConfig.maxChatCount
  975. )
  976. ;-1 !== offScreenChatIndex
  977. ? ((element = flowChats[offScreenChatIndex].element),
  978. flowChats.splice(offScreenChatIndex, 1))
  979. : (external_log_default().debug("CreateFlowChat"),
  980. (element = document.createElement("span")),
  981. chatScrn.append(element)),
  982. element.classList.add("fyc_chat")
  983. const flowChat = {
  984. element,
  985. lane: 0,
  986. animationEnded: !1,
  987. length: chatData.length,
  988. color: chatData.color,
  989. }
  990. ;(element.innerHTML = chatData.html),
  991. stylizeChat(flowChat, mainState, userConfig),
  992. (flowChat.lane = ((flowChat, flowChats, chatScrn, userConfig) => {
  993. const chatScreenRect = chatScrn.getBoundingClientRect(),
  994. screenWidth = chatScreenRect.width,
  995. screenX = chatScreenRect.x,
  996. newChatWidth = flowChat.element.getBoundingClientRect().width,
  997. chatsByLane = Array.from({
  998. length: 3 * userConfig.laneCount - 1,
  999. }).map(() => [])
  1000. let laneNum
  1001. return (
  1002. flowChats
  1003. .filter(chat => !chat.animationEnded)
  1004. .forEach(chat => chatsByLane[chat.lane].push(chat)),
  1005. (laneNum = chatsByLane.findIndex(chats =>
  1006. chats.every(chat => {
  1007. const rect = chat.element.getBoundingClientRect(),
  1008. chatX = rect.x - screenX,
  1009. gap = (rect.width * newChatWidth) ** 0.5 / 3
  1010. return (
  1011. (screenWidth - chatX) / (screenWidth + rect.width) >
  1012. (newChatWidth + gap) / (screenWidth + newChatWidth) &&
  1013. rect.right + gap < screenWidth
  1014. )
  1015. })
  1016. )),
  1017. -1 === laneNum && (laneNum = 0),
  1018. laneNum
  1019. )
  1020. })(flowChat, flowChats, chatScrn, userConfig)),
  1021. (element.onanimationend = () => {
  1022. ;(flowChat.animationEnded = !0), setChatAnimation(flowChat)
  1023. }),
  1024. setChatAnimation(flowChat),
  1025. flowChats.push(flowChat)
  1026. },
  1027. chatFieldObserver = (chatScrn, flowChats, mainState, userConfig) =>
  1028. new MutationObserver(mutations => {
  1029. mutations.forEach(e => {
  1030. Array.from(e.addedNodes)
  1031. .filter(x => x.children.length > 0)
  1032. .forEach(chat => {
  1033. const chatData = ((chat, userConfig) => {
  1034. let html = "",
  1035. length = 0
  1036. const isMember = Boolean(chat.querySelector(".member"))
  1037. let authorID
  1038. const color = chat.querySelector(".owner")
  1039. ? userConfig.ownerColor
  1040. : chat.querySelector(".moderator")
  1041. ? userConfig.moderatorColor
  1042. : isMember
  1043. ? userConfig.memberColor
  1044. : userConfig.color
  1045. return (
  1046. Array.from(chat.children).forEach(child => {
  1047. var _a, _b, _c, _d
  1048. const childID = child.id,
  1049. message = child.querySelector("#message"),
  1050. authorName = child.querySelector("#author-name")
  1051. if (
  1052. "content" === childID &&
  1053. (chat.querySelector(".moderator") &&
  1054. !0 === userConfig.displayModeratorName &&
  1055. (html += `<span style="font-size: smaller;">${
  1056. null == authorName ? void 0 : authorName.innerText
  1057. }: </span>`),
  1058. message)
  1059. ) {
  1060. const result = parseMessage(
  1061. length,
  1062. message,
  1063. userConfig
  1064. )
  1065. ;(html += result.html), (length += result.length)
  1066. }
  1067. if ("author-photo" === childID) {
  1068. const matches = (
  1069. (null === (_a = child.lastElementChild) ||
  1070. void 0 === _a
  1071. ? void 0
  1072. : _a.getAttribute("src")) || ""
  1073. ).match(/ytc\/(.*)=/)
  1074. authorID =
  1075. null == matches
  1076. ? void 0
  1077. : matches[matches.length - 1]
  1078. }
  1079. if ("card" === childID) {
  1080. const paidAmount =
  1081. child.querySelector("#purchase-amount") ||
  1082. child.querySelector("#purchase-amount-chip")
  1083. if (
  1084. child.matches(
  1085. [
  1086. ".style-scope",
  1087. ".yt-live-chat-paid-message-renderer",
  1088. ].join("")
  1089. )
  1090. ) {
  1091. const header = tapNonNull(
  1092. child.querySelector("#header")
  1093. ),
  1094. content = child.querySelector("#content"),
  1095. headerColor = window
  1096. .getComputedStyle(header)
  1097. .getPropertyValue("background-color"),
  1098. paidColor = window
  1099. .getComputedStyle(content)
  1100. .getPropertyValue("background-color")
  1101. if (message) {
  1102. const result = parseMessage(
  1103. length,
  1104. message,
  1105. userConfig
  1106. )
  1107. ;(html += `<span style="color: ${headerColor}; font-size: smaller;">${
  1108. null == authorName
  1109. ? void 0
  1110. : authorName.innerText
  1111. }: </span><span style="color: ${headerColor};">${
  1112. result.html
  1113. }</span><span style="color: ${paidColor}; font-size: smaller;"><strong>${
  1114. null == paidAmount
  1115. ? void 0
  1116. : paidAmount.innerText
  1117. }</strong></span>`),
  1118. (length +=
  1119. result.length +
  1120. (null !==
  1121. (_b =
  1122. null == paidAmount
  1123. ? void 0
  1124. : paidAmount.innerText.length) &&
  1125. void 0 !== _b
  1126. ? _b
  1127. : 0))
  1128. }
  1129. authorID = void 0
  1130. }
  1131. if (
  1132. child.matches(
  1133. [
  1134. ".style-scope",
  1135. ".yt-live-chat-paid-sticker-renderer",
  1136. ].join("")
  1137. )
  1138. ) {
  1139. const headerColor = window
  1140. .getComputedStyle(chat)
  1141. .getPropertyValue(
  1142. "--yt-live-chat-paid-sticker-chip-background-color"
  1143. ),
  1144. amountColor = window
  1145. .getComputedStyle(chat)
  1146. .getPropertyValue(
  1147. "--yt-live-chat-paid-sticker-background-color"
  1148. )
  1149. ;(html += `<span style="color: ${headerColor};">${
  1150. null == authorName ? void 0 : authorName.innerText
  1151. }: </span>`),
  1152. (html += `<span style="color: ${amountColor}; font-size: smaller;"><strong>${
  1153. null == paidAmount
  1154. ? void 0
  1155. : paidAmount.innerText
  1156. }</strong></span>`),
  1157. (length +=
  1158. null !==
  1159. (_d =
  1160. null ===
  1161. (_c =
  1162. null == paidAmount
  1163. ? void 0
  1164. : paidAmount.innerText) ||
  1165. void 0 === _c
  1166. ? void 0
  1167. : _c.length) && void 0 !== _d
  1168. ? _d
  1169. : 0),
  1170. (authorID = void 0)
  1171. }
  1172. }
  1173. }),
  1174. { html, length, color, authorID }
  1175. )
  1176. })(chat, userConfig)
  1177. ;((chatData, userConfig) =>
  1178. userConfig.bannedWords.some(
  1179. word =>
  1180. !!chatData.html.includes(word) &&
  1181. (external_log_default().debug(
  1182. `Banned Word: "${word}" in "${chatData.html}"`
  1183. ),
  1184. !0)
  1185. ))(chatData, userConfig) ||
  1186. ((chatData, userConfig) =>
  1187. userConfig.bannedWordRegexs.some(word => {
  1188. const result = chatData.html.match(word)
  1189. return (
  1190. !!result &&
  1191. (external_log_default().debug(
  1192. `Banned Word: "${result}" in "${chatData.html}"`
  1193. ),
  1194. !0)
  1195. )
  1196. }))(chatData, userConfig) ||
  1197. ((chatData, userConfig) =>
  1198. Boolean(chatData.authorID) &&
  1199. userConfig.bannedUsers.some(user => {
  1200. var _a
  1201. const result =
  1202. null === (_a = chatData.authorID) || void 0 === _a
  1203. ? void 0
  1204. : _a.match(user)
  1205. return (
  1206. !!result &&
  1207. (external_log_default().debug(
  1208. `Banned User: "${result}" in "${chatData.html}"`
  1209. ),
  1210. !0)
  1211. )
  1212. }))(chatData, userConfig)
  1213. ? (chat.style.display = "none")
  1214. : ((chat.style.display =
  1215. chat.querySelectorAll(
  1216. ".style-scope.yt-live-chat-paid-message-renderer"
  1217. ).length > 0
  1218. ? "block"
  1219. : "flex"),
  1220. userConfig.createChats &&
  1221. createChat(
  1222. chatData,
  1223. flowChats,
  1224. chatScrn,
  1225. mainState,
  1226. userConfig
  1227. ),
  1228. userConfig.createBanButtons &&
  1229. chatData.authorID &&
  1230. !chat.querySelector(".owner") &&
  1231. createBanButton(chat, chatData.authorID, userConfig),
  1232. ((chat, simplify) => {
  1233. if (
  1234. ((chat.style.borderBottom = simplify
  1235. ? "1px solid var(--yt-spec-text-secondary)"
  1236. : "none"),
  1237. chat.querySelector(
  1238. ".style-scope.yt-live-chat-paid-message-renderer"
  1239. ) || chat.querySelector(".owner"))
  1240. )
  1241. return
  1242. const authorPhoto = chat.querySelector("#author-photo")
  1243. authorPhoto &&
  1244. (authorPhoto.style.display = simplify
  1245. ? "none"
  1246. : "block")
  1247. const authorChip = chat.querySelector(
  1248. "yt-live-chat-author-chip.style-scope.yt-live-chat-text-message-renderer"
  1249. )
  1250. authorChip &&
  1251. (authorChip.style.display = simplify
  1252. ? "none"
  1253. : "inline-flex")
  1254. })(chat, userConfig.simplifyChatField))
  1255. })
  1256. })
  1257. }),
  1258. componentMounter = (root, placeRoot) => component => {
  1259. const success = placeRoot(root)
  1260. return success && external_m_default().mount(root, component), success
  1261. },
  1262. createScriptCss = userConfig => {
  1263. var _a, _b, _c, _d, _e, _f
  1264. const screenWidth =
  1265. null !==
  1266. (_b =
  1267. null === (_a = livePage_getPlayer()) || void 0 === _a
  1268. ? void 0
  1269. : _a.clientWidth) && void 0 !== _b
  1270. ? _b
  1271. : 0,
  1272. screenHeight =
  1273. null !==
  1274. (_d =
  1275. null === (_c = livePage_getMainVideo()) || void 0 === _c
  1276. ? void 0
  1277. : _c.clientHeight) && void 0 !== _d
  1278. ? _d
  1279. : 0,
  1280. screenY =
  1281. ((null !==
  1282. (_f =
  1283. null === (_e = livePage_getPlayer()) || void 0 === _e
  1284. ? void 0
  1285. : _e.clientHeight) && void 0 !== _f
  1286. ? _f
  1287. : 0) -
  1288. screenHeight) /
  1289. 2
  1290. let styleHtml = ""
  1291. ;(styleHtml +=
  1292. ".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: forwards;\n will-change: transform;\n }"),
  1293. (styleHtml +=
  1294. ".fyc_chat > img {\n vertical-align: text-top;\n }"),
  1295. (styleHtml +=
  1296. ".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 }")
  1297. const { laneCount } = userConfig
  1298. for (let i = 0; i < 3 * laneCount - 1; i += 1) {
  1299. const lane = i % (2 * laneCount - 1),
  1300. laneHeight =
  1301. Math.round(
  1302. 100 *
  1303. (lane < laneCount
  1304. ? (screenHeight * (lane % laneCount)) / laneCount + 4
  1305. : screenHeight *
  1306. ((lane % laneCount) / laneCount + 1 / (2 * laneCount)))
  1307. ) / 100
  1308. styleHtml += `@keyframes lane${i} {from{ transform: translate(${screenWidth}px, ${
  1309. screenY + laneHeight
  1310. }px) translate(0%); } to{ transform: translate(0px, ${
  1311. screenY + laneHeight
  1312. }px) translate(-100%); }}\n`
  1313. }
  1314. ;(styleHtml +=
  1315. "@keyframes nolane {from{ transform: translate(-100%); } to{ transform: translate(-100%); }}\n"),
  1316. external_log_default().debug("AppendCss")
  1317. const existedElement = document.querySelector(".fyc_style"),
  1318. styleElement =
  1319. null != existedElement
  1320. ? existedElement
  1321. : document.createElement("style")
  1322. existedElement ||
  1323. (document.head.append(styleElement),
  1324. styleElement.classList.add(".fyc_style")),
  1325. (styleElement.innerHTML = styleHtml)
  1326. }
  1327. var delay = __webpack_require__(228),
  1328. delay_default = __webpack_require__.n(delay)
  1329. const setChatFrameCss = async () => (
  1330. await delay_default()(700),
  1331. (async (func, count, interval) => {
  1332. let exception,
  1333. succeed = !1
  1334. for (let i = 0; i < count; i += 1) {
  1335. try {
  1336. await func(i), (succeed = !0)
  1337. break
  1338. } catch (e) {
  1339. exception = e
  1340. }
  1341. external_log_default().debug("Retry"),
  1342. await delay_default()(interval)
  1343. }
  1344. if (!succeed) throw exception
  1345. })(
  1346. () => {
  1347. var _a, _b
  1348. const element =
  1349. null ===
  1350. (_b =
  1351. null === (_a = document.querySelector("#chatframe")) ||
  1352. void 0 === _a
  1353. ? void 0
  1354. : _a.contentDocument) || void 0 === _b
  1355. ? void 0
  1356. : _b.querySelector(
  1357. "#item-scroller.animated.yt-live-chat-item-list-renderer #item-offset.yt-live-chat-item-list-renderer"
  1358. )
  1359. element && (element.style.overflow = "unset")
  1360. },
  1361. 5,
  1362. 1e3
  1363. )
  1364. ),
  1365. settingPanel_option = (value, label) =>
  1366. external_m_default()("option", { value }, label),
  1367. settingRow = (label, content) =>
  1368. external_m_default()("div", [
  1369. external_m_default()("span", label),
  1370. external_m_default()("div", content),
  1371. ]),
  1372. textColorRow = (color, textStyle, oninput) =>
  1373. external_m_default()("div", [
  1374. external_m_default()("input", {
  1375. type: "text",
  1376. size: 10,
  1377. maxlength: 30,
  1378. value: color,
  1379. oninput,
  1380. }),
  1381. external_m_default()(
  1382. "span",
  1383. { style: { ...textStyle, color } },
  1384. "Aa1あア亜"
  1385. ),
  1386. ]),
  1387. rangeRow = (min, max, step, value, oninput) =>
  1388. external_m_default()("div", [
  1389. external_m_default()("input", {
  1390. style: { width: "150px", verticalAlign: "middle" },
  1391. type: "range",
  1392. min,
  1393. max,
  1394. step,
  1395. value,
  1396. oninput,
  1397. }),
  1398. external_m_default()("input", {
  1399. style: {
  1400. width: "30px",
  1401. backgroundColor: "transparent",
  1402. color: "inherit",
  1403. borderWidth: "1px",
  1404. verticalAlign: "middle",
  1405. },
  1406. inputmode: "decimal",
  1407. value,
  1408. onchange: oninput,
  1409. }),
  1410. ]),
  1411. checkboxRow = (label, checked, onchange) =>
  1412. external_m_default()(
  1413. "div",
  1414. external_m_default()("label", [
  1415. label,
  1416. external_m_default()("input", {
  1417. type: "checkbox",
  1418. checked,
  1419. onchange,
  1420. }),
  1421. ])
  1422. ),
  1423. getInputValue = e => {
  1424. const target = e.currentTarget
  1425. if (
  1426. target instanceof HTMLSelectElement ||
  1427. target instanceof HTMLTextAreaElement ||
  1428. target instanceof HTMLInputElement
  1429. )
  1430. return target.value
  1431. throw Error(
  1432. "Event target isn't an Input or TextArea or Input element"
  1433. )
  1434. },
  1435. getInputChecked = e => {
  1436. return ((constructor = HTMLInputElement),
  1437. (x = e.currentTarget),
  1438. assert_lib(x instanceof constructor),
  1439. x).checked
  1440. var constructor, x
  1441. },
  1442. langRecord = {
  1443. FYC_EN: {
  1444. language: "Language",
  1445. font: "Font",
  1446. color: "Color(Normal)",
  1447. ownerColor: "Color(Owner)",
  1448. moderatorColor: "Color(Moderator)",
  1449. memberColor: "Color(Member)",
  1450. feedback: "Give your feedbacks here",
  1451. chatOpacity: "Opacity",
  1452. fontSize: "Size",
  1453. fontWeight: "Weight",
  1454. shadowFontWeight: "Weight(Shadow)",
  1455. flowSpeed: "Speed",
  1456. maxChatCount: "Max number of chats",
  1457. maxChatLength: "Max number of characters",
  1458. laneCount: "Number of Line",
  1459. bannedWords: "Banned Words",
  1460. bannedWordRegexs: "Banned Words(Regex)",
  1461. bannedUsers: "Banned Users",
  1462. simplifyChatField: "Simplify",
  1463. createBanButton: "Show ban button",
  1464. displayModeratorName: "Show moderator's name",
  1465. createChats: "Display flowing chats",
  1466. textOnly: "Text only(ignore emojis)",
  1467. reload: "Reload",
  1468. save: "Save",
  1469. error: "Error",
  1470. video: "Video",
  1471. chatField: "Chat Window",
  1472. useStepTiming: "Move chat in steps",
  1473. timingStepCount: "└Step Count",
  1474. },
  1475. FYC_JA: {
  1476. language: "言語",
  1477. font: "フォント",
  1478. color: "色(通常)",
  1479. ownerColor: "色(オーナー)",
  1480. moderatorColor: "色(モデレーター)",
  1481. memberColor: "色(メンバー)",
  1482. feedback: "バグ報告、要望はこちら",
  1483. chatOpacity: "透明度",
  1484. fontSize: "サイズ",
  1485. fontWeight: "太さ",
  1486. shadowFontWeight: "太さ(影)",
  1487. flowSpeed: "速度",
  1488. maxChatCount: "最大表示数",
  1489. maxChatLength: "最大文字数",
  1490. laneCount: "行数",
  1491. bannedWords: "NGワード",
  1492. bannedWordRegexs: "NGワード(正規表現)",
  1493. bannedUsers: "NGユーザー",
  1494. simplifyChatField: "簡略化する",
  1495. createBanButton: "NGボタンを表示する",
  1496. displayModeratorName: "モデレータの名前を表示する",
  1497. createChats: "チャットを流す",
  1498. textOnly: "文字のみ(絵文字を無視する)",
  1499. reload: "再読み込み",
  1500. save: "保存",
  1501. error: "エラー",
  1502. video: "画面",
  1503. chatField: "チャット欄",
  1504. useStepTiming: "チャットを段階的に動かす",
  1505. timingStepCount: "└段階数",
  1506. },
  1507. },
  1508. langOptions = [
  1509. ["FYC_EN", "English"],
  1510. ["FYC_JA", "日本語"],
  1511. ],
  1512. fontOptions = [
  1513. ["", "Default", "デフォルト"],
  1514. ["arial", "Arial", "Arial"],
  1515. ["arial black", "Arial Black", "Arial Black"],
  1516. ["arial narrow", "Arial Narrow", "Arial Narrow"],
  1517. ["Century", "Century", "Century"],
  1518. ["Comic Sans MS", "Comic Sans MS", "Comic Sans MS"],
  1519. ["Courier", "Courier", "Courier"],
  1520. ["cursive", "cursive", "cursive"],
  1521. ["fantasy", "fantasy", "fantasy"],
  1522. ["Impact", "Impact", "Impact"],
  1523. ["Meiryo", "Meiryo", "メイリオ"],
  1524. ["Meiryo UI", "Meiryo UI", "メイリオ UI"],
  1525. ["monospace", "monospace", "monospace"],
  1526. ["Monotype Corsiva", "Monotype Corsiva", "Monotype Corsiva"],
  1527. ["MS PGothic", "MS PGothic", "MS Pゴシック"],
  1528. ["MS Gothic", "MS Gothic", "MS ゴシック"],
  1529. ["MS Sans Serif", "MS Sans Serif", "MS Sans Serif"],
  1530. ["MS Serif", "MS Serif", "MS Serif"],
  1531. ["MS UI Gothic", "MS UI Gothic", "MS UI Gothic"],
  1532. ["sans-serif", "Sans-serif", "Sans-serif"],
  1533. ["serif", "Serif", "Serif"],
  1534. ["Times New Roman", "Times New Roman", "Times New Roman"],
  1535. ["Yu Gothic", "Yu Gothic", "遊ゴシック"],
  1536. ["YuGothic", "YuGothic", "游ゴシック体"],
  1537. ],
  1538. settingPanel = (
  1539. flowChats,
  1540. recreateCss,
  1541. mainState,
  1542. state,
  1543. userConfig
  1544. ) => {
  1545. var _a, _b
  1546. const exampleTextStyle = () => ({
  1547. fontFamily: userConfig.font,
  1548. fontWeight: userConfig.fontWeight.toString(),
  1549. }),
  1550. panelState = {
  1551. bannedWordRegexs: userConfig.bannedWordRegexs,
  1552. bannedWordRegexsValid: !0,
  1553. bannedWordRegexsError: "",
  1554. currentBanTab: 0,
  1555. timingStepCount: parseInt(
  1556. null !==
  1557. (_b =
  1558. null ===
  1559. (_a = userConfig.timingFunction.match(
  1560. /^steps\((\d+),.+/
  1561. )) || void 0 === _a
  1562. ? void 0
  1563. : _a[1]) && void 0 !== _b
  1564. ? _b
  1565. : "150",
  1566. 10
  1567. ),
  1568. },
  1569. stepTiming = stepCount => `steps(${stepCount}, jump-end)`,
  1570. useStepTiming = () =>
  1571. Boolean(userConfig.timingFunction.match(/^steps\(.+/)),
  1572. panelBoxStyle = { flex: "0 0 212px", margin: "2px" },
  1573. textAreaStyle = {
  1574. resize: "horizontal",
  1575. boxSizing: "border-box",
  1576. width: "100%",
  1577. },
  1578. fieldSetStyle = { border: "solid 1px", padding: "3px" },
  1579. getLang = () => langRecord[userConfig.lang],
  1580. langSelectChange$ = new external_rxjs_namespaceObject.Subject(),
  1581. fontSelectChange$ = new external_rxjs_namespaceObject.Subject(),
  1582. colorInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1583. colorOwnerInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1584. colorModeratorInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1585. colorMemberInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1586. chatOpacityInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1587. fontSizeInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1588. fontWeightInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1589. shadowFontWeightInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1590. flowSpeedInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1591. maxChatCountInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1592. maxChatLengthInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1593. laneCountInputInput$ = new external_rxjs_namespaceObject.Subject(),
  1594. banTabChange$ = new external_rxjs_namespaceObject.Subject(),
  1595. bannedWordsTextAreaChange$ = new external_rxjs_namespaceObject.Subject(),
  1596. bannedWordRegexsTextAreaChange$ = new external_rxjs_namespaceObject.Subject(),
  1597. bannedUsersTextAreaChange$ = new external_rxjs_namespaceObject.Subject(),
  1598. simplifyChatFieldInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1599. createBanButtonInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1600. displayModeratorNameInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1601. createChatsInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1602. textOnlyInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1603. useStepTimingInputChange$ = new external_rxjs_namespaceObject.Subject(),
  1604. timingStepCountInputChange$ = new external_rxjs_namespaceObject.Subject()
  1605. return (
  1606. (0, external_rxjs_namespaceObject.merge)(
  1607. langSelectChange$.pipe(
  1608. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1609. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1610. ;(userConfig.lang = x), GM.setValue("FYC_LANG", x)
  1611. })
  1612. ),
  1613. fontSelectChange$.pipe(
  1614. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1615. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1616. ;(userConfig.font = x), GM.setValue("FYC_FONT", x)
  1617. })
  1618. ),
  1619. colorInputInput$.pipe(
  1620. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1621. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1622. ;(userConfig.color = x), GM.setValue("FYC_COLOR", x)
  1623. })
  1624. ),
  1625. colorOwnerInputInput$.pipe(
  1626. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1627. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1628. ;(userConfig.ownerColor = x),
  1629. GM.setValue("FYC_COLOR_OWNER", x)
  1630. })
  1631. ),
  1632. colorModeratorInputInput$.pipe(
  1633. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1634. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1635. ;(userConfig.moderatorColor = x),
  1636. GM.setValue("FYC_COLOR_MODERATOR", x)
  1637. })
  1638. ),
  1639. colorMemberInputInput$.pipe(
  1640. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1641. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1642. ;(userConfig.memberColor = x),
  1643. GM.setValue("FYC_COLOR_MEMBER", x)
  1644. })
  1645. ),
  1646. chatOpacityInputInput$.pipe(
  1647. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1648. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1649. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1650. ;(userConfig.chatOpacity = x), GM.setValue("FYC_OPACITY", x)
  1651. })
  1652. ),
  1653. fontSizeInputInput$.pipe(
  1654. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1655. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1656. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1657. ;(userConfig.fontSize = x), GM.setValue("FYC_SIZE", x)
  1658. })
  1659. ),
  1660. fontWeightInputInput$.pipe(
  1661. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1662. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1663. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1664. ;(userConfig.fontWeight = x), GM.setValue("FYC_WEIGHT", x)
  1665. })
  1666. ),
  1667. shadowFontWeightInputInput$.pipe(
  1668. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1669. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1670. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1671. ;(userConfig.shadowFontWeight = x),
  1672. GM.setValue("FYC_WEIGHT_SHADOW", x)
  1673. })
  1674. ),
  1675. flowSpeedInputInput$.pipe(
  1676. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1677. (0, external_rxjs_operators_namespaceObject.map)(parseFloat),
  1678. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1679. ;(userConfig.flowSpeed = x), GM.setValue("FYC_SPEED", x)
  1680. })
  1681. ),
  1682. maxChatCountInputInput$.pipe(
  1683. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1684. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1685. parseInt(x, 10)
  1686. ),
  1687. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1688. ;(userConfig.maxChatCount = x),
  1689. ((flowChats, maxChatCount) => {
  1690. flowChats
  1691. .splice(0, Math.max(0, flowChats.length - maxChatCount))
  1692. .forEach(x => {
  1693. external_log_default().debug("RemoveOldChat"),
  1694. x.element.remove()
  1695. })
  1696. })(flowChats, x),
  1697. GM.setValue("FYC_LIMIT", x)
  1698. })
  1699. ),
  1700. maxChatLengthInputInput$.pipe(
  1701. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1702. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1703. parseInt(x, 10)
  1704. ),
  1705. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1706. ;(userConfig.maxChatLength = x), GM.setValue("FYC_MAX", x)
  1707. })
  1708. ),
  1709. laneCountInputInput$.pipe(
  1710. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1711. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1712. parseInt(x, 10)
  1713. ),
  1714. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1715. ;(userConfig.laneCount = x),
  1716. recreateCss(),
  1717. flowChats.forEach(chat => {
  1718. chat.lane %= 3 * userConfig.laneCount - 1
  1719. }),
  1720. GM.setValue("FYC_LANE_DIV", x)
  1721. })
  1722. ),
  1723. banTabChange$.pipe(
  1724. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1725. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1726. parseInt(x, 10)
  1727. ),
  1728. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1729. panelState.currentBanTab = x
  1730. })
  1731. ),
  1732. bannedWordsTextAreaChange$.pipe(
  1733. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1734. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1735. x.split(/\r\n|\n/).filter(word => "" !== word)
  1736. ),
  1737. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1738. ;(userConfig.bannedWords = x),
  1739. GM.setValue("FYC_NG_WORDS", x.join("\n"))
  1740. })
  1741. ),
  1742. bannedWordRegexsTextAreaChange$.pipe(
  1743. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1744. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1745. x.split(/\r\n|\n/).filter(regex => "" !== regex)
  1746. ),
  1747. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1748. panelState.bannedWordRegexs = x
  1749. let valid = !0
  1750. ;(panelState.bannedWordRegexsError = ""),
  1751. panelState.bannedWordRegexs.forEach(regex => {
  1752. try {
  1753. new RegExp(regex)
  1754. } catch (error) {
  1755. logFyc(`Invalid Regex: ${regex}`),
  1756. external_log_default().warn(error),
  1757. (panelState.bannedWordRegexsError += `${error} in ${regex};`),
  1758. (valid = !1)
  1759. }
  1760. }),
  1761. valid &&
  1762. ((userConfig.bannedWordRegexs = x),
  1763. GM.setValue("FYC_NG_REG_WORDS", x.join("\n"))),
  1764. (panelState.bannedWordRegexsValid = valid)
  1765. })
  1766. ),
  1767. bannedUsersTextAreaChange$.pipe(
  1768. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1769. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1770. x.split(/\r\n|\n/).filter(user => "" !== user)
  1771. ),
  1772. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1773. ;(userConfig.bannedUsers = x),
  1774. GM.setValue("FYC_NG_USERS", x.join("\n"))
  1775. })
  1776. ),
  1777. simplifyChatFieldInputChange$.pipe(
  1778. (0, external_rxjs_operators_namespaceObject.map)(
  1779. getInputChecked
  1780. ),
  1781. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1782. ;(userConfig.simplifyChatField = x),
  1783. GM.setValue("FYC_SIMPLE_CHAT_FIELD", x)
  1784. })
  1785. ),
  1786. createBanButtonInputChange$.pipe(
  1787. (0, external_rxjs_operators_namespaceObject.map)(
  1788. getInputChecked
  1789. ),
  1790. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1791. ;(userConfig.createBanButtons = x),
  1792. GM.setValue("FYC_NG_BUTTON", x)
  1793. })
  1794. ),
  1795. displayModeratorNameInputChange$.pipe(
  1796. (0, external_rxjs_operators_namespaceObject.map)(
  1797. getInputChecked
  1798. ),
  1799. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1800. ;(userConfig.displayModeratorName = x),
  1801. GM.setValue("FYC_DISPLAY_MODERATOR_NAME", x)
  1802. })
  1803. ),
  1804. createChatsInputChange$.pipe(
  1805. (0, external_rxjs_operators_namespaceObject.map)(
  1806. getInputChecked
  1807. ),
  1808. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1809. ;(userConfig.createChats = x),
  1810. GM.setValue("FYC_TOGGLE_CREATE_COMMENTS", x)
  1811. })
  1812. ),
  1813. textOnlyInputChange$.pipe(
  1814. (0, external_rxjs_operators_namespaceObject.map)(
  1815. getInputChecked
  1816. ),
  1817. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1818. ;(userConfig.textOnly = x), GM.setValue("FYC_TEXT_ONLY", x)
  1819. })
  1820. ),
  1821. useStepTimingInputChange$.pipe(
  1822. (0, external_rxjs_operators_namespaceObject.map)(
  1823. getInputChecked
  1824. ),
  1825. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1826. ;(userConfig.timingFunction = x
  1827. ? stepTiming(panelState.timingStepCount)
  1828. : "linear"),
  1829. GM.setValue(
  1830. "FYC_TIMING_FUNCTION",
  1831. userConfig.timingFunction
  1832. )
  1833. })
  1834. ),
  1835. timingStepCountInputChange$.pipe(
  1836. (0, external_rxjs_operators_namespaceObject.map)(getInputValue),
  1837. (0, external_rxjs_operators_namespaceObject.map)(x =>
  1838. parseInt(x, 10)
  1839. ),
  1840. (0, external_rxjs_operators_namespaceObject.tap)(x => {
  1841. ;(panelState.timingStepCount = x),
  1842. (userConfig.timingFunction = stepTiming(x)),
  1843. GM.setValue(
  1844. "FYC_TIMING_FUNCTION",
  1845. userConfig.timingFunction
  1846. )
  1847. })
  1848. )
  1849. )
  1850. .pipe(
  1851. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  1852. flowChats
  1853. .filter(chat => !chat.animationEnded)
  1854. .forEach(chat => {
  1855. stylizeChat(chat, mainState, userConfig),
  1856. setChatAnimation(chat)
  1857. })
  1858. })
  1859. )
  1860. .subscribe(),
  1861. {
  1862. view: () => {
  1863. return external_m_default()(
  1864. "div",
  1865. {
  1866. className: "fyc_panel",
  1867. style: {
  1868. visibility: state.showPanel ? "visible" : "hidden",
  1869. backgroundColor: "rgba(30,30,30,0.9)",
  1870. zIndex: 5,
  1871. display: "flex",
  1872. position: "absolute",
  1873. bottom: "40px",
  1874. right: "0px",
  1875. padding: "6px",
  1876. color: "#fff",
  1877. fontSize: "14px",
  1878. width: "648px",
  1879. border: "solid 1px #666",
  1880. },
  1881. },
  1882. [
  1883. external_m_default()("div", { style: panelBoxStyle }, [
  1884. settingRow(getLang().language, [
  1885. external_m_default()(
  1886. "select",
  1887. {
  1888. style: { width: "60%" },
  1889. selectedIndex: langOptions.findIndex(
  1890. x => x[0] === userConfig.lang
  1891. ),
  1892. onchange: lib(langSelectChange$),
  1893. },
  1894. langOptions.map(x => settingPanel_option(...x))
  1895. ),
  1896. ]),
  1897. settingRow(getLang().font, [
  1898. external_m_default()(
  1899. "select",
  1900. {
  1901. style: { width: "60%" },
  1902. selectedIndex: fontOptions.findIndex(
  1903. x => x[0] === userConfig.font
  1904. ),
  1905. onchange: lib(fontSelectChange$),
  1906. },
  1907. fontOptions.map(x =>
  1908. settingPanel_option(
  1909. x[0],
  1910. "FYC_JA" === userConfig.lang ? x[2] : x[1]
  1911. )
  1912. )
  1913. ),
  1914. ]),
  1915. settingRow(getLang().color, [
  1916. textColorRow(
  1917. userConfig.color,
  1918. exampleTextStyle(),
  1919. lib(colorInputInput$)
  1920. ),
  1921. ]),
  1922. settingRow(getLang().ownerColor, [
  1923. textColorRow(
  1924. userConfig.ownerColor,
  1925. exampleTextStyle(),
  1926. lib(colorOwnerInputInput$)
  1927. ),
  1928. ]),
  1929. settingRow(getLang().moderatorColor, [
  1930. textColorRow(
  1931. userConfig.moderatorColor,
  1932. exampleTextStyle(),
  1933. lib(colorModeratorInputInput$)
  1934. ),
  1935. ]),
  1936. settingRow(getLang().memberColor, [
  1937. textColorRow(
  1938. userConfig.memberColor,
  1939. exampleTextStyle(),
  1940. lib(colorMemberInputInput$)
  1941. ),
  1942. ]),
  1943. external_m_default()(
  1944. "div",
  1945. { style: { textAlign: "right", margin: "3px 6px" } },
  1946. external_m_default()(
  1947. "a",
  1948. {
  1949. style: { color: "white" },
  1950. href:
  1951. "https://greasyfork.org/en/scripts/411442-flow-youtube-chat/feedback",
  1952. target: "_blank",
  1953. },
  1954. getLang().feedback
  1955. )
  1956. ),
  1957. ]),
  1958. external_m_default()("div", { style: panelBoxStyle }, [
  1959. settingRow(getLang().chatOpacity, [
  1960. rangeRow(
  1961. 0,
  1962. 1,
  1963. 0.05,
  1964. userConfig.chatOpacity,
  1965. lib(chatOpacityInputInput$)
  1966. ),
  1967. ]),
  1968. settingRow(getLang().fontSize, [
  1969. rangeRow(
  1970. 0.1,
  1971. 2,
  1972. 0.1,
  1973. userConfig.fontSize,
  1974. lib(fontSizeInputInput$)
  1975. ),
  1976. ]),
  1977. settingRow(getLang().fontWeight, [
  1978. rangeRow(
  1979. 10,
  1980. 1e3,
  1981. 10,
  1982. userConfig.fontWeight,
  1983. lib(fontWeightInputInput$)
  1984. ),
  1985. ]),
  1986. settingRow(getLang().shadowFontWeight, [
  1987. rangeRow(
  1988. 0,
  1989. 3,
  1990. 0.1,
  1991. userConfig.shadowFontWeight,
  1992. lib(shadowFontWeightInputInput$)
  1993. ),
  1994. ]),
  1995. settingRow(getLang().flowSpeed, [
  1996. rangeRow(
  1997. 1,
  1998. 50,
  1999. 1,
  2000. userConfig.flowSpeed,
  2001. lib(flowSpeedInputInput$)
  2002. ),
  2003. ]),
  2004. settingRow(getLang().maxChatCount, [
  2005. rangeRow(
  2006. 5,
  2007. 200,
  2008. 5,
  2009. userConfig.maxChatCount,
  2010. lib(maxChatCountInputInput$)
  2011. ),
  2012. ]),
  2013. settingRow(getLang().maxChatLength, [
  2014. rangeRow(
  2015. 5,
  2016. 200,
  2017. 5,
  2018. userConfig.maxChatLength,
  2019. lib(maxChatLengthInputInput$)
  2020. ),
  2021. ]),
  2022. settingRow(getLang().laneCount, [
  2023. rangeRow(
  2024. 1,
  2025. 20,
  2026. 1,
  2027. userConfig.laneCount,
  2028. lib(laneCountInputInput$)
  2029. ),
  2030. ]),
  2031. ]),
  2032. external_m_default()("div", { style: panelBoxStyle }, [
  2033. ((labels = [
  2034. getLang().bannedWords,
  2035. getLang().bannedWordRegexs,
  2036. getLang().bannedUsers,
  2037. ]),
  2038. (tabs = [
  2039. [
  2040. external_m_default()(
  2041. "textarea",
  2042. {
  2043. rows: 4,
  2044. style: textAreaStyle,
  2045. onchange: lib(bannedWordsTextAreaChange$),
  2046. },
  2047. userConfig.bannedWords.join("\n")
  2048. ),
  2049. ],
  2050. [
  2051. external_m_default()(
  2052. "span",
  2053. panelState.bannedWordRegexsValid
  2054. ? ""
  2055. : `${getLang().error}: ${
  2056. panelState.bannedWordRegexsError
  2057. }`
  2058. ),
  2059. external_m_default()(
  2060. "textarea",
  2061. {
  2062. rows: 4,
  2063. style: textAreaStyle,
  2064. onchange: lib(bannedWordRegexsTextAreaChange$),
  2065. },
  2066. panelState.bannedWordRegexs.join("\n")
  2067. ),
  2068. ],
  2069. [
  2070. external_m_default()(
  2071. "textarea",
  2072. {
  2073. rows: 4,
  2074. style: textAreaStyle,
  2075. onchange: lib(bannedUsersTextAreaChange$),
  2076. },
  2077. userConfig.bannedUsers.join("\n")
  2078. ),
  2079. ],
  2080. ]),
  2081. (currentTab = panelState.currentBanTab),
  2082. (onchange = lib(banTabChange$)),
  2083. external_m_default()("div", [
  2084. external_m_default()(
  2085. "select",
  2086. {
  2087. style: { width: "100%" },
  2088. selectedIndex: currentTab,
  2089. onchange,
  2090. },
  2091. labels.map((x, i) =>
  2092. settingPanel_option(i.toString(), x)
  2093. )
  2094. ),
  2095. ...tabs.map((x, i) =>
  2096. external_m_default()(
  2097. "div",
  2098. {
  2099. style: {
  2100. display: i === currentTab ? "block" : "none",
  2101. },
  2102. },
  2103. x
  2104. )
  2105. ),
  2106. ])),
  2107. external_m_default()(
  2108. "fieldset",
  2109. { style: fieldSetStyle },
  2110. [
  2111. external_m_default()("legend", getLang().chatField),
  2112. checkboxRow(
  2113. getLang().simplifyChatField,
  2114. userConfig.simplifyChatField,
  2115. lib(simplifyChatFieldInputChange$)
  2116. ),
  2117. checkboxRow(
  2118. getLang().createBanButton,
  2119. userConfig.createBanButtons,
  2120. lib(createBanButtonInputChange$)
  2121. ),
  2122. ]
  2123. ),
  2124. external_m_default()(
  2125. "fieldset",
  2126. { style: fieldSetStyle },
  2127. [
  2128. external_m_default()("legend", getLang().video),
  2129. checkboxRow(
  2130. getLang().displayModeratorName,
  2131. userConfig.displayModeratorName,
  2132. lib(displayModeratorNameInputChange$)
  2133. ),
  2134. checkboxRow(
  2135. getLang().createChats,
  2136. userConfig.createChats,
  2137. lib(createChatsInputChange$)
  2138. ),
  2139. checkboxRow(
  2140. getLang().textOnly,
  2141. userConfig.textOnly,
  2142. lib(textOnlyInputChange$)
  2143. ),
  2144. checkboxRow(
  2145. getLang().useStepTiming,
  2146. useStepTiming(),
  2147. lib(useStepTimingInputChange$)
  2148. ),
  2149. external_m_default()(
  2150. "div",
  2151. {
  2152. style: {
  2153. display: useStepTiming() ? "block" : "none",
  2154. },
  2155. },
  2156. settingRow(getLang().timingStepCount, [
  2157. rangeRow(
  2158. 1,
  2159. 400,
  2160. 1,
  2161. panelState.timingStepCount,
  2162. lib(timingStepCountInputChange$)
  2163. ),
  2164. ])
  2165. ),
  2166. ]
  2167. ),
  2168. ]),
  2169. ]
  2170. )
  2171. var labels, tabs, currentTab, onchange
  2172. },
  2173. }
  2174. )
  2175. },
  2176. settingComponent = (flowChats, recreateCss, mainState, userConfig) => {
  2177. const state = { showPanel: !1 },
  2178. panel = settingPanel(
  2179. flowChats,
  2180. recreateCss,
  2181. mainState,
  2182. state,
  2183. userConfig
  2184. ),
  2185. toggleButton = ((state, userConfig) => {
  2186. const click$ = new external_rxjs_namespaceObject.Subject()
  2187. return (
  2188. click$
  2189. .pipe(
  2190. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2191. state.showPanel = !state.showPanel
  2192. })
  2193. )
  2194. .subscribe(),
  2195. {
  2196. view: () =>
  2197. external_m_default()(
  2198. "button",
  2199. {
  2200. className: "fyc_button",
  2201. style: {
  2202. background: "rgba(0,0,0,0)",
  2203. marginLeft: "10px",
  2204. whiteSpace: "nowrap",
  2205. },
  2206. onclick: lib(click$),
  2207. },
  2208. [
  2209. external_m_default()(
  2210. "svg",
  2211. {
  2212. preserveAspectRatio: "xMidYMid meet",
  2213. viewBox: "0 0 640 640",
  2214. width: "15",
  2215. height: "15",
  2216. style: { position: "relative", top: "1px" },
  2217. },
  2218. [
  2219. external_m_default()(
  2220. "defs",
  2221. external_m_default()("path", {
  2222. id: "d1TbzTC1zI",
  2223. d:
  2224. "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",
  2225. })
  2226. ),
  2227. external_m_default()("use", {
  2228. "xlink:href": "#d1TbzTC1zI",
  2229. opacity: "1",
  2230. fill: "var(--iron-icon-fill-color, currentcolor)",
  2231. "fill-opacity": "1",
  2232. }),
  2233. ]
  2234. ),
  2235. external_m_default()(
  2236. "span",
  2237. {
  2238. style: {
  2239. position: "relative",
  2240. top: "-2px",
  2241. marginLeft: "8px,",
  2242. },
  2243. },
  2244. "FYC_JA" === userConfig.lang ? "設定" : "Settings"
  2245. ),
  2246. ]
  2247. ),
  2248. }
  2249. )
  2250. })(state, userConfig)
  2251. return {
  2252. view: () =>
  2253. external_m_default()("span", { style: { display: "contents" } }, [
  2254. external_m_default()(panel),
  2255. external_m_default()(toggleButton),
  2256. ]),
  2257. }
  2258. },
  2259. videoToggleStream = video =>
  2260. (0, external_rxjs_namespaceObject.merge)(
  2261. (0, external_rxjs_namespaceObject.fromEvent)(video, "playing").pipe(
  2262. (0, external_rxjs_operators_namespaceObject.mapTo)(!0)
  2263. ),
  2264. (0, external_rxjs_namespaceObject.fromEvent)(video, "waiting").pipe(
  2265. (0, external_rxjs_operators_namespaceObject.mapTo)(!1)
  2266. ),
  2267. (0, external_rxjs_namespaceObject.fromEvent)(video, "pause").pipe(
  2268. (0, external_rxjs_operators_namespaceObject.mapTo)(!1)
  2269. )
  2270. ),
  2271. requirementMet = () =>
  2272. livePage_getChatFrame() &&
  2273. livePage_getChatField() &&
  2274. livePage_getPlayer(),
  2275. initialize = async () => {
  2276. logFyc("Script started")
  2277. const userConfig = await (async () => ({
  2278. lang: tapNonNull(await GM.getValue("FYC_LANG", "FYC_EN")),
  2279. font: tapNonNull(await GM.getValue("FYC_FONT", "")),
  2280. chatOpacity: tapNonNull(await GM.getValue("FYC_OPACITY", 1)),
  2281. color: tapNonNull(await GM.getValue("FYC_COLOR", "#FFFFFF")),
  2282. ownerColor: tapNonNull(
  2283. await GM.getValue("FYC_COLOR_OWNER", "#ffd600")
  2284. ),
  2285. moderatorColor: tapNonNull(
  2286. await GM.getValue("FYC_COLOR_MODERATOR", "#5e84f1")
  2287. ),
  2288. memberColor: tapNonNull(
  2289. await GM.getValue("FYC_COLOR_MEMBER", "#2ba640")
  2290. ),
  2291. fontSize: tapNonNull(await GM.getValue("FYC_SIZE", 1)),
  2292. fontWeight: tapNonNull(await GM.getValue("FYC_WEIGHT", 730)),
  2293. shadowFontWeight: tapNonNull(
  2294. await GM.getValue("FYC_WEIGHT_SHADOW", 1)
  2295. ),
  2296. maxChatCount: tapNonNull(await GM.getValue("FYC_LIMIT", 25)),
  2297. flowSpeed: tapNonNull(await GM.getValue("FYC_SPEED", 18)),
  2298. maxChatLength: tapNonNull(await GM.getValue("FYC_MAX", 100)),
  2299. laneCount: tapNonNull(await GM.getValue("FYC_LANE_DIV", 12)),
  2300. bannedWords: tapNonNull(await GM.getValue("FYC_NG_WORDS", ""))
  2301. .split(/\r\n|\n/)
  2302. .filter(x => "" !== x),
  2303. bannedWordRegexs: tapNonNull(
  2304. await GM.getValue("FYC_NG_REG_WORDS", "")
  2305. )
  2306. .split(/\r\n|\n/)
  2307. .filter(x => "" !== x),
  2308. bannedUsers: tapNonNull(await GM.getValue("FYC_NG_USERS", ""))
  2309. .split(/\r\n|\n/)
  2310. .filter(x => "" !== x),
  2311. createChats: tapNonNull(
  2312. await GM.getValue("FYC_TOGGLE_CREATE_COMMENTS", !0)
  2313. ),
  2314. displayChats: tapNonNull(
  2315. await GM.getValue("FYC_DISPLAY_COMMENTS", !0)
  2316. ),
  2317. createBanButtons: tapNonNull(
  2318. await GM.getValue("FYC_NG_BUTTON", !0)
  2319. ),
  2320. simplifyChatField: tapNonNull(
  2321. await GM.getValue("FYC_SIMPLE_CHAT_FIELD", !1)
  2322. ),
  2323. displayModeratorName: tapNonNull(
  2324. await GM.getValue("FYC_DISPLAY_MODERATOR_NAME", !0)
  2325. ),
  2326. textOnly: tapNonNull(await GM.getValue("FYC_TEXT_ONLY", !1)),
  2327. timingFunction: tapNonNull(
  2328. await GM.getValue("FYC_TIMING_FUNCTION", "linear")
  2329. ),
  2330. }))(),
  2331. reinitSubject = new external_rxjs_namespaceObject.Subject(),
  2332. reinitialize = lib(reinitSubject),
  2333. chatScrn = (() => {
  2334. const element = document.createElement("div")
  2335. return (
  2336. element.classList.add("fyc_chat_screen"),
  2337. (element.style.pointerEvents = "none"),
  2338. (element.style.zIndex = "30"),
  2339. element
  2340. )
  2341. })(),
  2342. flowChats = []
  2343. let chatField, video, player
  2344. const mainState = { videoPlaying: !1 }
  2345. let storedHref = window.location.href
  2346. new MutationObserver(async () => {
  2347. storedHref !== window.location.href &&
  2348. ((storedHref = window.location.href),
  2349. logFyc("URL Changed", storedHref),
  2350. await reinitialize())
  2351. }).observe(document, { childList: !0, subtree: !0 })
  2352. const chatObserver = chatFieldObserver(
  2353. chatScrn,
  2354. flowChats,
  2355. mainState,
  2356. userConfig
  2357. ),
  2358. playerResizeSubject = new external_rxjs_namespaceObject.Subject(),
  2359. playerResizeObserver = new ResizeObserver(lib(playerResizeSubject)),
  2360. toggleChatBtn = ((flowChats, userConfig) => {
  2361. const click$ = new external_rxjs_namespaceObject.Subject()
  2362. click$
  2363. .pipe(
  2364. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2365. const newDisplay = !userConfig.displayChats
  2366. flowChats.forEach(x => {
  2367. x.element.style.visibility = newDisplay
  2368. ? "visible"
  2369. : "hidden"
  2370. }),
  2371. (userConfig.displayChats = newDisplay),
  2372. GM.setValue("FYC_DISPLAY_COMMENTS", newDisplay)
  2373. })
  2374. )
  2375. .subscribe()
  2376. const label = () =>
  2377. "チャット" + (userConfig.displayChats ? "非表示" : "表示")
  2378. return {
  2379. view: () =>
  2380. external_m_default()(
  2381. "button",
  2382. {
  2383. className: ["ytp-button"].join(" "),
  2384. style: {
  2385. background: "none",
  2386. border: "none",
  2387. cursor: "pointer",
  2388. float: "left",
  2389. fontSize: "1em",
  2390. height: "4em",
  2391. outline: "none",
  2392. overflow: "visible",
  2393. padding: "0 0 0em",
  2394. position: "relative",
  2395. width: "3em",
  2396. },
  2397. type: "button",
  2398. "aria-label": label(),
  2399. title: label(),
  2400. onclick: lib(click$),
  2401. },
  2402. [
  2403. external_m_default()(
  2404. "svg",
  2405. { style: { width: "100%" }, viewBox: "0 0 36 36" },
  2406. [
  2407. external_m_default()("path", {
  2408. className: ["chat-button-path"].join(" "),
  2409. d:
  2410. "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",
  2411. fill: "#fff",
  2412. "fill-opacity": userConfig.displayChats ? "1" : "0",
  2413. stroke: "#fff",
  2414. "stroke-width": "2",
  2415. }),
  2416. ]
  2417. ),
  2418. ]
  2419. ),
  2420. }
  2421. })(flowChats, userConfig),
  2422. mountToggleChatBtn = componentMounter(
  2423. document.createElement("span"),
  2424. x => {
  2425. const parent = document.querySelector(".ytp-right-controls")
  2426. return (
  2427. parent && (parent.append(x), (x.style.display = "contents")),
  2428. Boolean(parent)
  2429. )
  2430. }
  2431. ),
  2432. settingComp = settingComponent(
  2433. flowChats,
  2434. () => createScriptCss(userConfig),
  2435. mainState,
  2436. userConfig
  2437. ),
  2438. mountSettingComp = componentMounter(
  2439. document.createElement("span"),
  2440. x => {
  2441. const parent = document.querySelector(
  2442. "#menu-container .dropdown-trigger.style-scope.ytd-menu-renderer"
  2443. )
  2444. return (
  2445. parent &&
  2446. (parent.insertAdjacentElement("beforebegin", x),
  2447. (x.style.display = "contents")),
  2448. Boolean(parent)
  2449. )
  2450. }
  2451. )
  2452. external_log_default().debug("Append ToggleChatDisplayButton")
  2453. reinitSubject
  2454. .pipe(
  2455. (0, external_rxjs_operators_namespaceObject.observeOn)(
  2456. external_rxjs_namespaceObject.asyncScheduler
  2457. ),
  2458. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2459. (0, external_rxjs_namespaceObject.interval)(800).pipe(
  2460. (0, external_rxjs_operators_namespaceObject.startWith)(0),
  2461. (0, external_rxjs_operators_namespaceObject.map)(
  2462. requirementMet
  2463. ),
  2464. (0, external_rxjs_operators_namespaceObject.filter)(() => {
  2465. var _a, _b
  2466. const chatFieldDetached =
  2467. chatField &&
  2468. !(null ===
  2469. (_b =
  2470. null === (_a = livePage_getChatFrame()) ||
  2471. void 0 === _a
  2472. ? void 0
  2473. : _a.contentDocument) || void 0 === _b
  2474. ? void 0
  2475. : _b.contains(chatField)) &&
  2476. !document.contains(chatField),
  2477. logDetached = x => `${x} detached, will reload...`
  2478. chatFieldDetached &&
  2479. (logDetached("Chat field"), (chatField = void 0))
  2480. const videoDetached = video && !document.contains(video)
  2481. videoDetached &&
  2482. (logDetached("Video"),
  2483. (video = void 0),
  2484. (mainState.videoPlaying = !1))
  2485. const playerDetached = player && !document.contains(player)
  2486. playerDetached && (logDetached("Player"), (player = void 0))
  2487. const detached =
  2488. chatFieldDetached || videoDetached || playerDetached
  2489. return detached && reinitialize(), !detached
  2490. }),
  2491. (0, external_rxjs_operators_namespaceObject.startWith)(!1),
  2492. (0,
  2493. external_rxjs_operators_namespaceObject.distinctUntilChanged)(),
  2494. (0, external_rxjs_operators_namespaceObject.tap)(x =>
  2495. logFyc(
  2496. x
  2497. ? "Found the chat container and the player"
  2498. : "Waiting to load..."
  2499. )
  2500. ),
  2501. (0, external_rxjs_operators_namespaceObject.filter)(Boolean)
  2502. )
  2503. ),
  2504. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2505. logFyc("Wait for 2300ms...")
  2506. ),
  2507. (0, external_rxjs_operators_namespaceObject.delay)(2300),
  2508. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2509. logFyc("Initializing...")
  2510. ),
  2511. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2512. var _a
  2513. flowChats.splice(0, flowChats.length).forEach(chat => {
  2514. chat.element.remove()
  2515. }),
  2516. chatObserver.disconnect(),
  2517. (chatField = livePage_getChatField()),
  2518. chatField &&
  2519. chatObserver.observe(chatField, { childList: !0 }),
  2520. (video = livePage_getMainVideo()),
  2521. video &&
  2522. (external_log_default().debug("AppendChatScreen"),
  2523. (mainState.videoPlaying = !video.paused),
  2524. null === (_a = livePage_getPlayer()) ||
  2525. void 0 === _a ||
  2526. _a.insertAdjacentElement("afterbegin", chatScrn)),
  2527. playerResizeObserver.disconnect(),
  2528. (player = livePage_getPlayer()),
  2529. player && playerResizeObserver.observe(player),
  2530. mountToggleChatBtn(toggleChatBtn),
  2531. mountSettingComp(settingComp),
  2532. createScriptCss(userConfig),
  2533. (chatField && video && player) || reinitialize()
  2534. }),
  2535. (0, external_rxjs_operators_namespaceObject.switchMap)(
  2536. setChatFrameCss
  2537. ),
  2538. (0, external_rxjs_operators_namespaceObject.switchMap)(() =>
  2539. (0, external_rxjs_namespaceObject.merge)(
  2540. ...(video
  2541. ? [
  2542. videoToggleStream(video).pipe(
  2543. (0, external_rxjs_operators_namespaceObject.tap)(
  2544. playing => {
  2545. ;(mainState.videoPlaying = playing),
  2546. flowChats.forEach(chat => {
  2547. stylizeChat(chat, mainState, userConfig)
  2548. })
  2549. }
  2550. )
  2551. ),
  2552. ]
  2553. : []),
  2554. playerResizeSubject.pipe(
  2555. (0, external_rxjs_operators_namespaceObject.debounceTime)(
  2556. 800
  2557. ),
  2558. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2559. logFyc("Resize detected")
  2560. ),
  2561. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2562. createScriptCss(userConfig)
  2563. ),
  2564. (0, external_rxjs_operators_namespaceObject.tap)(() => {
  2565. flowChats.forEach(chat => {
  2566. stylizeChat(chat, mainState, userConfig)
  2567. })
  2568. })
  2569. )
  2570. )
  2571. ),
  2572. (0, external_rxjs_operators_namespaceObject.retryWhen)(x =>
  2573. x.pipe(
  2574. (0, external_rxjs_operators_namespaceObject.tap)(() =>
  2575. logFyc("Errored:")
  2576. ),
  2577. (0, external_rxjs_operators_namespaceObject.tap)(
  2578. external_log_default().warn
  2579. )
  2580. )
  2581. )
  2582. )
  2583. .subscribe(),
  2584. await reinitialize()
  2585. }
  2586. ;(async () => {
  2587. external_log_namespaceObject.setLevel("info")
  2588. try {
  2589. await initialize()
  2590. } catch (error) {
  2591. external_log_namespaceObject.error(error)
  2592. }
  2593. })()
  2594. })()
  2595. })()