@@ -8,26 +8,27 @@ import {
88import { useInit } from 'main' ;
99
1010( async ( ) => {
11- const isMangaPage = ( ) => location . pathname . match ( / ^ \/ [ 0 - 9 ] + - / ) !== null ;
11+ const isMangaPage = ( ) => location . pathname . match ( / ^ \/ \d + - / ) !== null ;
1212
1313 const original = async ( ) => {
1414 const url = new URL ( location . href ) ;
1515 const parts = url . pathname . split ( '-' ) ;
1616 parts . splice ( 1 , 0 , 'online' ) ;
1717 url . pathname = parts . join ( '-' ) ;
1818
19- const html = await fetch ( url ) . then ( e => e . text ( ) ) ;
19+ const html = await fetch ( url ) . then ( ( e ) => e . text ( ) ) ;
2020 const doc = domParse ( html ) ;
2121
22- const script = Array . from ( doc . querySelectorAll ( "script" ) )
23- . filter ( e => e . textContent . includes ( "/manga/" ) ) ?. [ 0 ] ;
22+ const script = [ ...doc . querySelectorAll ( 'script' ) ] . find ( ( e ) =>
23+ e . textContent . includes ( '/manga/' ) ,
24+ ) ;
2425 if ( ! script ) return [ ] ;
2526
2627 return Array . from (
2728 script . textContent . matchAll ( / \/ m a n g a \/ [ ^ ' ] + / g) ,
28- ( e ) => `https://nude-moon.org${ e [ 0 ] } `
29+ ( e ) => `https://nude-moon.org${ e [ 0 ] } ` ,
2930 ) ;
30- }
31+ } ;
3132
3233 const { setState } = await useInit ( 'nude-moon' , {
3334 autoShow : false ,
@@ -36,10 +37,9 @@ import { useInit } from 'main';
3637
3738 setState ( ( state ) => {
3839 if ( isMangaPage ( ) ) state . comicMap [ '' ] . getImgList = original ;
39- } )
40+ } ) ;
4041
4142 linstenKeydown ( ( e ) => {
42- console . log ( hotkeysMap ( ) , getKeyboardCode ( e ) ) ;
4343 switch ( hotkeysMap ( ) [ getKeyboardCode ( e ) ] ) {
4444 case 'scroll_right' :
4545 e . preventDefault ( ) ;
0 commit comments