Skip to content

Commit

Permalink
fix: 🐛 兼容 AdGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
hymbz committed Jun 21, 2024
1 parent 5869bd9 commit 157a296
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion metaHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ export const getMetaData = (isDevMode: boolean) => {
grant: [
'GM_addElement',
'GM_getResourceText',
'GM_addStyle',
'GM_xmlhttpRequest',
'GM.addValueChangeListener',
'GM.removeValueChangeListener',
'GM.getResourceText',
'GM.addStyle',
'GM.getValue',
'GM.setValue',
'GM.listValues',
Expand Down
2 changes: 1 addition & 1 deletion src/components/useComponents/Fab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mountComponents } from './helper';
let dom: HTMLDivElement;

export const useFab = async (initProps?: FabProps) => {
await GM.addStyle(`
GM_addStyle(`
#fab {
--text-bg: transparent;
Expand Down
2 changes: 1 addition & 1 deletion src/components/useComponents/Manga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type UseMangaProps = MangaProps & { adList?: Set<number> };
* 显示漫画阅读窗口
*/
export const useManga = async (initProps?: Partial<UseMangaProps>) => {
await GM.addStyle(`
GM_addStyle(`
#comicRead {
position: fixed;
top: 0;
Expand Down
1 change: 1 addition & 0 deletions src/helper/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const gmApi = {
typeof GM_addElement === 'undefined' ? undefined : GM_addElement,
GM_getResourceText,
GM_xmlhttpRequest,
GM_addStyle,
unsafeWindow,
};
const gmApiList = Object.keys(gmApi);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ try {
}

// 让切换章节的提示可以显示在漫画页上
GM.addStyle(`#smh-msg-box { z-index: 2147483647 !important }`);
GM_addStyle(`#smh-msg-box { z-index: 2147483647 !important }`);

const handlePrevNext = (cid: number) => {
if (cid === 0) return undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/site/dmzj_phone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import {
});

document.body.childNodes[0].remove();
await GM.addStyle(
GM_addStyle(
`
h1 {
margin: 0 -20vw;
Expand Down Expand Up @@ -135,7 +135,7 @@ import {
case 'view': {
// 如果不是隐藏漫画,直接进入阅读模式
if (unsafeWindow.comic_id) {
await GM.addStyle('.subHeader{display:none !important}');
GM_addStyle('.subHeader{display:none !important}');

await universalInit({
name: 'dmzj',
Expand Down
4 changes: 2 additions & 2 deletions src/site/nhentai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ declare const gallery: { num_pages: number; media_id: string; images: Images };
// blacklist === null 时是未登录

if (options.block_totally && blacklist?.length)
await GM.addStyle('.blacklisted.gallery { display: none; }');
GM_addStyle('.blacklisted.gallery { display: none; }');

if (options.auto_page_turn) {
await GM.addStyle(`
GM_addStyle(`
hr { bottom: 0; box-sizing: border-box; margin: -1em auto 2em; }
hr:last-child { position: relative; animation: load .8s linear alternate infinite; }
hr:not(:last-child) { display: none; }
Expand Down
2 changes: 1 addition & 1 deletion src/site/yamibo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface History {
自动签到: true,
});

await GM.addStyle(
GM_addStyle(
`#fab { --fab: #6E2B19; fab-hover: #A15640; }
${
Expand Down

0 comments on commit 157a296

Please sign in to comment.