Skip to content

Commit

Permalink
ManHuaGui: delay page script (#7265)
Browse files Browse the repository at this point in the history
well, website is too slow
  • Loading branch information
MikeZeDev authored and ronny1982 committed Jul 27, 2024
1 parent 2f73173 commit deb4ee8
Showing 1 changed file with 13 additions and 5 deletions.
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);
}
}
}

0 comments on commit deb4ee8

Please sign in to comment.