Add enhanced features to the comic site for optimized experience, including dual-page reading and translation. E-Hentai (Associate nhentai, Quick favorite, Colorize tags, Floating tag list, etc.) | nhentai (Totally block comics, Auto page turning) | hitomi | hdoujin | SchaleNetwork | nude-moon | HentaiZap | IMHentai | HentaiEra | HentaiEnvy | kemono | nekohouse | MangaDex | welovemanga
我今天也遇到這問題,改寫了下代碼用window.fetch可以秒獲取。
// 在目录页显示上次阅读记录
if (window.location.href.includes('/comic/')) {
const comicName = window.location.href.split('/comic/')[1];
if (!comicName || !token) return;
let a;
const setStyle = main.createStyle();
const updateLastChapter = async () => {
// 因为拷贝漫画的目录是动态加载的,所以要等目录加载出来再往上添加
if (document.cookie.includes("token")) {
if (!!document.querySelector("#lastRead")) {
a = document.querySelector("#lastRead");
} else {
a = document.createElement("a");
a.id = "lastRead";
a.target = "_blank";
const tableRight = await main.wait(() => main.querySelector(".table-default-right"));
tableRight.insertBefore(a, tableRight.firstElementChild);
const span = document.createElement("span");
span.innerText = "最後閱讀:";
tableRight.insertBefore(span, tableRight.firstElementChild);
}
a.innerText = "獲取中";
a.removeAttribute("href");
const [, , name] = window.location.pathname.split("/");
const [, token] = /token=([^;]+)/.exec(document.cookie);
const headers = new Headers({
Authorization: `Token ${token}`
});
window.fetch(`/api/v3/comic2/${name}/query?platform=3`, {
headers: headers
}).then(res => res.json()).then(json => {
if (!!json.results?.browse) {
const lastChapterId = json.results.browse?.chapter_id;
if (!lastChapterId) {
a.innerText = '接口異常';
return;
}
a.href = window.location.pathname + "/chapter/" + lastChapterId;
a.innerText = json.results.browse.chapter_name;
setStyle(`ul a[href*="${lastChapterId}"] {
color: #fff !important;
background: #1790E6;
}`);
} else {
a.innerText = "無";
}
}).catch(error => {
a.innerText = "接口異常";
console.error(error);
});
}
};
updateLastChapter();
document.addEventListener('visibilitychange', updateLastChapter);
}
我今天也遇到這問題,改寫了下代碼用window.fetch可以秒獲取。
『最後閱讀:獲取中』可以正常秒獲取了 十分感謝tony0809
已更新修复
辛苦了~^^
拷贝漫画,『最後閱讀:獲取中』、『加载图片中』,讀取時間變得很長,約20秒,有重新安裝版本 8.10.0,但是還是沒改善,網站本身圖片加載很快,不知道是哪邊的問題?