File tree Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -94,12 +94,13 @@ export default {
9494 let count = 0 ;
9595
9696 const btns = [ ] ;
97- UfsGlobal . DOM . onElementsAdded (
97+ const unobserver = UfsGlobal . DOM . onElementsAdded (
9898 [ "en" , "vi" ]
9999 . map ( ( l ) =>
100100 type === Types . removeReact
101101 ? Object . values ( Reactions ) . map (
102- ( r ) => `[aria-label='${ type [ l ] } ${ r [ l ] } ']:not(li *)`
102+ ( r ) =>
103+ `[aria-label='${ type [ l ] } ${ r [ l ] } ']:not(li *):not([hidden] *)`
103104 )
104105 : `[aria-label='${ type [ l ] } ']:not(li *)`
105106 )
@@ -131,24 +132,6 @@ export default {
131132 block : "center" ,
132133 behavior : "smooth" ,
133134 } ) ;
134- await sleep ( 500 ) ;
135- btn . click ( ) ;
136-
137- if ( type === Types . addReact ) {
138- await sleep ( 500 ) ;
139-
140- let reactBtn = document . querySelector (
141- [ reaction . en , reaction . vi ]
142- . map ( ( _ ) => `[aria-label='${ _ } ']` )
143- . join ( ", " )
144- ) ;
145- if ( reactBtn ) {
146- focusTo ( reactBtn ) ;
147- await sleep ( 100 ) ;
148- reactBtn . click ( ) ;
149- await sleep ( 100 ) ;
150- }
151- }
152135
153136 let waitFor = rand ( 1000 , 4000 ) ;
154137 count ++ ;
@@ -166,8 +149,27 @@ export default {
166149 ) ;
167150
168151 await sleep ( waitFor ) ;
152+
153+ btn . click ( ) ;
154+
155+ if ( type === Types . addReact ) {
156+ await sleep ( 500 ) ;
157+
158+ let reactBtn = document . querySelector (
159+ [ reaction . en , reaction . vi ]
160+ . map ( ( _ ) => `[aria-label='${ _ } ']` )
161+ . join ( ", " )
162+ ) ;
163+ if ( reactBtn ) {
164+ focusTo ( reactBtn ) ;
165+ await sleep ( 100 ) ;
166+ reactBtn . click ( ) ;
167+ await sleep ( 100 ) ;
168+ }
169+ }
169170 }
170171
172+ unobserver ?. ( ) ;
171173 let text = type . name + ": " + count + " posts" ;
172174 notify . setText ( text , 5000 ) ;
173175 isRunning ( false ) ;
You can’t perform that action at this time.
0 commit comments