Skip to content

Commit 07b8ac4

Browse files
committed
feat: add nude-moon support
1 parent eab7f3b commit 07b8ac4

5 files changed

Lines changed: 65 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Cotrans 也有自己的油猴脚本 —— 「[Cotrans 漫画/图片翻译器](h
210210
- [熱辣漫畫](https://www.relamanhua.org/)
211211
- [hitomi](https://hitomi.la)
212212
- [SchaleNetwork](https://schale.network/)
213+
- [nude-moon](https://nude-moon.org)
213214
- [kemono](https://kemono.su)
214215
- [nekohouse](https://nekohouse.su)
215216
- [welovemanga](https://welovemanga.one)

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Cotrans 也有自己的油猴脚本 —— 「[Cotrans 漫画/图片翻译器](h
210210
- [熱辣漫畫](https://www.relamanhua.org/)
211211
- [hitomi](https://hitomi.la)
212212
- [SchaleNetwork](https://schale.network/)
213+
- [nude-moon](https://nude-moon.org)
213214
- [kemono](https://kemono.su)
214215
- [nekohouse](https://nekohouse.su)
215216
- [welovemanga](https://welovemanga.one)

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,13 @@ try {
819819
break;
820820
}
821821

822+
// #[nude-moon](https://nude-moon.org)
823+
// test: https://nude-moon.org/22729--zone-himitsu-no-tomodachi--tayney-drug.html
824+
case 'nude-moon.org': {
825+
inject('site/nude-moon');
826+
break;
827+
}
828+
822829
// #[kemono](https://kemono.su)
823830
// test: https://kemono.cr/fanbox/user/41106591/post/6813818
824831
case 'kemono.cr':

src/rollup-plugin/metaHeader.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const enSupportSite = [
8585
'hitomi',
8686
'Anchira',
8787
'kemono',
88+
'nude-moon',
8889
'nekohouse',
8990
'welovemanga',
9091
];

src/site/nude-moon.tsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import {
2+
domParse,
3+
onUrlChange,
4+
waitUrlChange,
5+
} from 'helper';
6+
import { useInit } from 'main';
7+
8+
(async () => {
9+
const isMangaPage = () => location.pathname.match(/^\/[0-9]+--/);
10+
await waitUrlChange(isMangaPage);
11+
12+
const { store, setState, showComic, init } = await useInit('nude-moon', {
13+
autoShow: false,
14+
defaultOption: { pageNum: 1 },
15+
});
16+
17+
const original = async () => {
18+
const url = new URL(location.href);
19+
const parts = url.pathname.split('-');
20+
parts.splice(1, 0, 'online');
21+
url.pathname = parts.join('-');
22+
23+
const html = await fetch(url).then(e => e.text());
24+
const doc = domParse(html);
25+
26+
const script = Array.from(doc.querySelectorAll("script"))
27+
.filter(e => e.textContent.includes("/manga/"))?.[0];
28+
if (!script) return [];
29+
30+
return Array.from(
31+
script.textContent.matchAll(/\/manga\/[^']+/g),
32+
(e) => `https://nude-moon.org${e[0]}`
33+
);
34+
}
35+
setState('comicMap', '', { getImgList: original })
36+
37+
onUrlChange(async (lastUrl) => {
38+
if (!lastUrl) return;
39+
40+
if (!isMangaPage())
41+
return setState((state) => {
42+
state.fab.show = false;
43+
state.manga.show = false;
44+
});
45+
46+
setState((state) => {
47+
state.fab.show = undefined;
48+
state.manga.show = false;
49+
});
50+
51+
if (store.options.autoShow) await showComic();
52+
});
53+
54+
init();
55+
})();

0 commit comments

Comments
 (0)