为漫画站增加双页阅读、翻译等优化体验的增强功能。百合会(记录阅读历史、自动签到等)、百合会新站、E-Hentai(关联外站、快捷收藏、标签染色、识别广告页等)、nhentai(彻底屏蔽漫画、无限滚动)、Yurifans(自动签到)、拷贝漫画(copymanga)(显示最后阅读记录、解锁隐藏漫画)、再漫画、漫画柜(manhuagui)、动漫屋(dm5)、mangabz、komiic、無限動漫、绅士漫画(wnacg)、禁漫天堂、NoyAcg、熱辣漫畫、hanime1、hitomi、hdoujin、SchaleNetwork、nude-moon、HentaiZap、IMHentai、HentaiEra、HentaiEnvy、MangaDex、welovemanga、kemono、nekohouse、Pixiv、明日方舟泰拉记事社、最前線、芸能ヌード、Tachidesk、LANraragi
我今天也遇到這問題,改寫了下代碼用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,但是還是沒改善,網站本身圖片加載很快,不知道是哪邊的問題?