Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManHuaGui: delay page script #7265

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/web/mjs/connectors/ManHuaGui.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,25 @@ export default class ManHuaGui extends SinMH {
}
};
this.queryPagesScript =`
new Promise(resolve => {
new Promise( (resolve, reject) => {
${this.api}.imgData = function(data) {
let origin = pVars.manga.filePath;
let pageLinks = data.files.map(file => origin + file + '?e=' + data.sl.e + '&m=' + data.sl.m);
return {
preInit: () => resolve(pageLinks)
};
};
let script = [...document.querySelectorAll('script:not([src])')].find(script => script.text.trim().startsWith('window[')).text;
eval(script);
} );

setTimeout(() => {
try {
let script = [...document.querySelectorAll('script:not([src])')].find(script => script.text.trim().startsWith('window[')).text;
eval(script);
}
catch(error) {
reject(error);
}
},1500);
});
`;
}

Expand All @@ -47,4 +55,4 @@ export default class ManHuaGui extends SinMH {
let msg = 'This function was disabled to prevent of being IP banned by the website owner, please copy and paste the URL containing the chapters directly from your browser into HakuNeko.';
throw new Error(msg);
}
}
}
Loading