@@ -16,7 +16,7 @@ import { DPlayerCommentPayload } from "../miraktest-dplayer/types"
16
16
import { ChatInput , PECORE_ID } from "../pecore"
17
17
import { useRefFromState } from "../shared/utils"
18
18
import tailwind from "../tailwind.scss"
19
- import { trimCommentForFlow } from "./comment"
19
+ import { classfySource , trimCommentForFlow } from "./comment"
20
20
import { SayaSetting } from "./types"
21
21
22
22
/**
@@ -31,7 +31,7 @@ const meta = {
31
31
id : _id ,
32
32
name : "Saya" ,
33
33
author : "ci7lus" ,
34
- version : "0.2.0 " ,
34
+ version : "0.2.1 " ,
35
35
description :
36
36
"Sayaからコメントを取得するプラグインです。対応するコメントレンダラープラグインが必要です。" ,
37
37
}
@@ -45,6 +45,9 @@ const main: InitPlugin = {
45
45
replaces : [ ] ,
46
46
isEnabled : true ,
47
47
isTimeshiftEnabled : true ,
48
+ isTwitterDisabled : false ,
49
+ is5chDisabled : false ,
50
+ isNicojkDisabled : false ,
48
51
} ,
49
52
} )
50
53
const sayaUrlHistoryAtom = atom < string [ ] > ( {
@@ -194,6 +197,16 @@ const main: InitPlugin = {
194
197
setRawComment ( payload )
195
198
const commentText = trimCommentForFlow ( payload . text )
196
199
if ( commentText . trim ( ) . length === 0 ) return
200
+ const source = classfySource ( payload . source )
201
+ if ( sayaSetting . isTwitterDisabled && source === "twitter" ) {
202
+ return
203
+ }
204
+ if ( sayaSetting . is5chDisabled && source === "5ch" ) {
205
+ return
206
+ }
207
+ if ( sayaSetting . isNicojkDisabled && source === "nicojk" ) {
208
+ return
209
+ }
197
210
if ( isDplayerFound ) {
198
211
const event = new CustomEvent ( DPLAYER_COMMENT_EVENT , {
199
212
bubbles : false ,
@@ -270,6 +283,15 @@ const main: InitPlugin = {
270
283
const [ repl2 , setRepl2 ] = useState ( "" )
271
284
const [ sayaHistoryUrl , setSayaHistoryUrl ] =
272
285
useRecoilState ( sayaUrlHistoryAtom )
286
+ const [ is5chDisabled , setIs5chDisabled ] = useState (
287
+ sayaSetting . is5chDisabled
288
+ )
289
+ const [ isTwitterDisabled , setIsTwitterDisabled ] = useState (
290
+ sayaSetting . isTwitterDisabled
291
+ )
292
+ const [ isNicojkDisabled , setIsNicojkDisabled ] = useState (
293
+ sayaSetting . isNicojkDisabled
294
+ )
273
295
return (
274
296
< >
275
297
< style > { tailwind } </ style >
@@ -294,6 +316,9 @@ const main: InitPlugin = {
294
316
replaces,
295
317
isEnabled,
296
318
isTimeshiftEnabled,
319
+ is5chDisabled,
320
+ isTwitterDisabled,
321
+ isNicojkDisabled,
297
322
} )
298
323
} }
299
324
>
@@ -396,6 +421,37 @@ const main: InitPlugin = {
396
421
</ button >
397
422
</ div >
398
423
</ label >
424
+ < label className = "block mt-4" >
425
+ < span > Twitterを除外する</ span >
426
+ < input
427
+ type = "checkbox"
428
+ className = "block mt-2 form-checkbox"
429
+ checked = { isTwitterDisabled || false }
430
+ onChange = { ( ) =>
431
+ setIsTwitterDisabled ( ( enabled ) => ! enabled )
432
+ }
433
+ />
434
+ </ label >
435
+ < label className = "block mt-4" >
436
+ < span > 5chを除外する</ span >
437
+ < input
438
+ type = "checkbox"
439
+ className = "block mt-2 form-checkbox"
440
+ checked = { is5chDisabled || false }
441
+ onChange = { ( ) => setIs5chDisabled ( ( enabled ) => ! enabled ) }
442
+ />
443
+ </ label >
444
+ < label className = "block mt-4" >
445
+ < span > ニコニコ実況を除外する</ span >
446
+ < input
447
+ type = "checkbox"
448
+ className = "block mt-2 form-checkbox"
449
+ checked = { isNicojkDisabled || false }
450
+ onChange = { ( ) =>
451
+ setIsNicojkDisabled ( ( enabled ) => ! enabled )
452
+ }
453
+ />
454
+ </ label >
399
455
< button
400
456
type = "submit"
401
457
className = "bg-gray-100 text-gray-800 p-2 px-2 my-4 rounded-md focus:outline-none cursor-pointer"
0 commit comments