@@ -5,7 +5,7 @@ const getCount = (search) =>
55 . substring ( 1 )
66 . split ( '&' )
77 . filter ( ( s ) => s . startsWith ( 'count=' ) )
8- . map ( ( s ) => parseInt ( s . split ( '=' ) [ 1 ] ) ) [ 0 ] ;
8+ . map ( ( s ) => Number . parseInt ( s . split ( '=' ) [ 1 ] ) ) [ 0 ] ;
99
1010const getType = ( search ) =>
1111 search
@@ -46,10 +46,10 @@ class Engine {
4646
4747 initCountLink ( ) {
4848 const toggleCountLinks = ( count ) => {
49- this . countLinks . forEach ( ( link ) => {
49+ for ( const link of this . countLinks ) {
5050 link . classList . toggle ( 'active' , false ) ;
51- } ) ;
52- const link = [ ...this . countLinks ] . filter ( ( l ) => l . innerText == count ) [ 0 ] ;
51+ }
52+ const link = [ ...this . countLinks ] . filter ( ( l ) => l . innerText === count ) [ 0 ] ;
5353 if ( link ) {
5454 link . classList . toggle ( 'active' , true ) ;
5555 this . count = count ;
@@ -67,7 +67,7 @@ class Engine {
6767 link . addEventListener ( 'click' , ( event ) => {
6868 event . preventDefault ( ) ;
6969 event . stopPropagation ( ) ;
70- const count = parseInt ( link . innerText ) ;
70+ const count = Number . parseInt ( link . innerText ) ;
7171 const type = getType ( search ) || this . type ;
7272 if ( count ) {
7373 if ( type )
@@ -87,12 +87,10 @@ class Engine {
8787
8888 initTypeLink ( ) {
8989 const toggleTypeLinks = ( type ) => {
90- this . typeLinks . forEach ( ( link ) => {
90+ for ( const link of this . typeLinks ) {
9191 link . classList . toggle ( 'active' , false ) ;
92- } ) ;
93- const link = [ ...this . typeLinks ] . filter (
94- ( l ) => l . innerText . toLowerCase ( ) == type
95- ) [ 0 ] ;
92+ }
93+ const link = [ ...this . typeLinks ] . filter ( ( l ) => l . innerText . toLowerCase ( ) === type ) [ 0 ] ;
9694 if ( link ) {
9795 link . classList . toggle ( 'active' , true ) ;
9896 this . type = type ;
@@ -134,7 +132,7 @@ class Engine {
134132 const navLinks = document . querySelectorAll ( 'header > nav > a' ) ;
135133 const { search, pathname } = window . location ;
136134
137- [ ...navLinks ] . forEach ( ( ml ) => {
135+ for ( const ml of [ ...navLinks ] ) {
138136 if ( ml . pathname === pathname ) ml . classList . add ( 'active' ) ;
139137 ml . addEventListener ( 'click' , ( event ) => {
140138 event . preventDefault ( ) ;
@@ -145,15 +143,15 @@ class Engine {
145143 if ( type ) href += `${ count ? '&' : '?' } type=${ type } ` ;
146144 window . location . href = href ;
147145 } ) ;
148- } ) ;
146+ }
149147 }
150148
151149 init ( ) {
152150 this . initFpsmeter ( ) ;
153151 this . initNavLink ( ) ;
154152 }
155153
156- render ( ) { }
154+ render ( ) { }
157155}
158156
159157export default Engine ;
0 commit comments