Flow Youtube Chat

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

目前為 2021-02-03 提交的版本,檢視 最新版本

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