diff --git a/dist/jhs-enhance.user.js b/dist/jhs-enhance.user.js index 70d1673..f43a45d 100644 --- a/dist/jhs-enhance.user.js +++ b/dist/jhs-enhance.user.js @@ -2879,10 +2879,7 @@ ${value}\r carNum2 = dateElements.find(((i) => !isDate(i))) || null; } if (!carNum2) { - const msg = "提取番号信息失败: carNum 为空"; - console.error("Error in getBoxCarInfo:", msg, "Box Element:", $box2.get(0)); - show.error(msg); - throw new Error(msg); + return null; } return { carNum: carNum2, @@ -3435,7 +3432,7 @@ ${value}\r async shouldDisablePaging() { if (!window.isListPage) return true; await storageManager.getSetting("autoPage", YES$1); - return ["search?q", "handlePlayback=1", "handleTop=1", "/want_watch_videos", "/watched_videos", "/advanced_search?type=100"].some(((path) => currentHref$1.includes(path))); + return ["search?q", "/rankings/playback", "/rankings/top", "/want_watch_videos", "/watched_videos", "/advanced_search?type=100"].some(((path) => currentHref$1.includes(path))); } updatePageUrl_old(href) { window.history.pushState({}, "", href); @@ -9488,7 +9485,7 @@ ${value}\r $('a[href*="rankings/playback"]').on("click", ((event) => { event.preventDefault(); event.stopPropagation(); - window.location.href = "/advanced_search?handlePlayback=1&period=daily"; + window.location.href = "/rankings/playback"; })); this.handlePlayback().then(); } @@ -9503,7 +9500,7 @@ ${value}\r this.$contentBox.append('
'); } async handlePlayback() { - if (!window.location.href.includes("handlePlayback=1")) return; + if (!window.location.href.includes("rankings/playback")) return; let period = new URLSearchParams(window.location.search).get("period"); this.toolBar(period); this.hookPage(); @@ -9514,6 +9511,7 @@ ${value}\r const movies = await javDbApi.playback(period); let moviesHtml = javDbApi.markDataListHtml(movies); $movieBox.html(moviesHtml); + this.pluginManager.getBean("ListPagePlugin").doFilter(); } catch (e) { clog.error("发生错误:", e); } finally { @@ -9524,9 +9522,9 @@ ${value}\r let conditionHtml = `
- 日榜 - 周榜 - 月榜 + 日榜 + 周榜 + 月榜
`; @@ -9641,9 +9639,16 @@ ${err.stack}` : ""); })); } async handleTop() { - if (!window.location.href.includes("handleTop=1")) return; + if (!window.location.href.includes("/rankings/top")) return; const urlParams = new URLSearchParams(window.location.search); - let type = urlParams.get("handleType") || "all", type_value = urlParams.get("type_value") || ""; + let t = urlParams.get("t") || "", type = "all", type_value = ""; + if (/^y\d+$/.test(t)) { + type = "year"; + type_value = t.substring(1); + } else if ("" !== t) { + type = "video_type"; + type_value = t; + } this.has_cnsub = urlParams.get("has_cnsub") || ""; let page = urlParams.get("page") || 1; this.toolBar(type, type_value, page); @@ -9665,6 +9670,7 @@ ${err.stack}` : ""); const filter_movies = dataList.filter(((item) => "1" === this.has_cnsub ? item.has_cnsub : "0" !== this.has_cnsub || !item.has_cnsub)); let moviesHtml = javDbApi.markDataListHtml(filter_movies); $movieBox.html(moviesHtml); + this.pluginManager.getBean("ListPagePlugin").doFilter(); } else { clog.error(res); $movieBox.html(`

${message}

`); @@ -9690,18 +9696,18 @@ ${err.stack}` : ""); for (let year = (/* @__PURE__ */ new Date()).getFullYear(); year >= 2008; year--) yearHtml += ` + href="/rankings/top?t=y${year}&has_cnsub=${this.has_cnsub}"> ${year} `; let conditionHtml = `
- 全部 - 有码 - 无码 - 欧美 - Fc2 + 全部 + 有码 + 无码 + 欧美 + Fc2 含中字磁鏈 无字幕 @@ -9743,7 +9749,8 @@ ${err.stack}` : ""); type = "video_type"; type_value = t; } - let url = `/advanced_search?handleTop=1&handleType=${type}&type_value=${type_value}`; + let tParam = "year" === type ? `y${type_value}` : "all" === type ? "" : type_value; + let url = `/rankings/top${tParam ? `?t=${tParam}` : ""}`; event && (event.ctrlKey || event.metaKey) ? _GM_openInTab(window.location.origin + url, { insert: 0 }) : window.location.href = url; @@ -9808,7 +9815,7 @@ ${err.stack}` : ""); await localStorage.setItem("jhs_appAuthorization", token); show.ok("登录成功"); layer.close(index); - window.location.href = "/advanced_search?handleTop=1&period=daily"; + window.location.href = "/rankings/top"; } } })).catch(((err) => { @@ -17098,12 +17105,10 @@ ${err.stack}` : ""); await Promise.all(movieList.map((async (ele) => { let $box2 = $(ele); if (isJavBus$1 && $box2.find(".avatar-box").length > 0) return; - const {carNum: carNum2, title} = this.getBoxCarInfo($box2), { - filter, - favorite, - hasDown, - hasWatch - } = carNumSets, isFavorite = favorite.has(carNum2), isHasDown = hasDown.has(carNum2), + const boxInfo = this.getBoxCarInfo($box2); + if (!boxInfo) return; + const {carNum: carNum2, title} = boxInfo, {filter, favorite, hasDown, hasWatch} = carNumSets, + isFavorite = favorite.has(carNum2), isHasDown = hasDown.has(carNum2), isHasWatch = hasWatch.has(carNum2), isFiltered = filter.has(carNum2), isFilterActorMale = actorCarNumToNameMap.has(carNum2), isFilterActorFemale = actressCarNumToNameMap.has(carNum2), diff --git a/src/core/base-plugin.js b/src/core/base-plugin.js index 311be43..efb7ec4 100644 --- a/src/core/base-plugin.js +++ b/src/core/base-plugin.js @@ -145,10 +145,7 @@ class BasePlugin { carNum2 = dateElements.find((i => !isDate(i))) || null; } if (!carNum2) { - const msg = "提取番号信息失败: carNum 为空"; - console.error("Error in getBoxCarInfo:", msg, "Box Element:", $box2.get(0)); - show.error(msg); - throw new Error(msg); + return null; } return { carNum: carNum2, diff --git a/src/plugins/auto-page.js b/src/plugins/auto-page.js index cc0db62..c5dca22 100644 --- a/src/plugins/auto-page.js +++ b/src/plugins/auto-page.js @@ -152,7 +152,7 @@ class AutoPagePlugin extends BasePlugin { async shouldDisablePaging() { if (!window.isListPage) return !0; await storageManager.getSetting("autoPage", YES); - return [ "search?q", "handlePlayback=1", "handleTop=1", "/want_watch_videos", "/watched_videos", "/advanced_search?type=100" ].some((path => currentHref.includes(path))); + return ["search?q", "/rankings/playback", "/rankings/top", "/want_watch_videos", "/watched_videos", "/advanced_search?type=100"].some((path => currentHref.includes(path))); } updatePageUrl_old(href) { window.history.pushState({}, "", href); diff --git a/src/plugins/hit-show.js b/src/plugins/hit-show.js index 884bd95..fbbf122 100644 --- a/src/plugins/hit-show.js +++ b/src/plugins/hit-show.js @@ -14,7 +14,7 @@ class HitShowPlugin extends BasePlugin { $('a[href*="rankings/playback"]').on("click", (event => { event.preventDefault(); event.stopPropagation(); - window.location.href = "/advanced_search?handlePlayback=1&period=daily"; + window.location.href = "/rankings/playback"; })); this.handlePlayback().then(); } @@ -29,7 +29,7 @@ class HitShowPlugin extends BasePlugin { this.$contentBox.append('
'); } async handlePlayback() { - if (!window.location.href.includes("handlePlayback=1")) return; + if (!window.location.href.includes("rankings/playback")) return; let period = new URLSearchParams(window.location.search).get("period"); this.toolBar(period); this.hookPage(); @@ -40,6 +40,7 @@ class HitShowPlugin extends BasePlugin { const movies = await javDbApi.playback(period); let moviesHtml = javDbApi.markDataListHtml(movies); $movieBox.html(moviesHtml); + this.pluginManager.getBean("ListPagePlugin").doFilter(); } catch (e) { clog.error("发生错误:", e); } finally { @@ -47,7 +48,7 @@ class HitShowPlugin extends BasePlugin { } } toolBar(period) { - let conditionHtml = `\n
\n
\n 日榜\n 周榜\n 月榜\n
\n
\n `; + let conditionHtml = `\n
\n
\n 日榜\n 周榜\n 月榜\n
\n
\n `; this.$contentBox.append(conditionHtml); } getStarRating(score) { diff --git a/src/plugins/list-page.js b/src/plugins/list-page.js index 944ed42..760e0bf 100644 --- a/src/plugins/list-page.js +++ b/src/plugins/list-page.js @@ -151,7 +151,20 @@ class ListPagePlugin extends BasePlugin { await Promise.all(movieList.map((async ele => { let $box2 = $(ele); if (isJavBus && $box2.find(".avatar-box").length > 0) return; - const {carNum: carNum2, title: title} = this.getBoxCarInfo($box2), {filter: filter, favorite: favorite, hasDown: hasDown, hasWatch: hasWatch} = carNumSets, isFavorite = favorite.has(carNum2), isHasDown = hasDown.has(carNum2), isHasWatch = hasWatch.has(carNum2), isFiltered = filter.has(carNum2), isFilterActorMale = actorCarNumToNameMap.has(carNum2), isFilterActorFemale = actressCarNumToNameMap.has(carNum2), isFilterActor = isFilterActorMale || isFilterActorFemale, foundKeyword = filterKeywordList.find((kw => title.includes(kw) || carNum2.startsWith(kw))), isFilterKeyword = !!foundKeyword; + const boxInfo = this.getBoxCarInfo($box2); + if (!boxInfo) return; + const {carNum: carNum2, title: title} = boxInfo, { + filter: filter, + favorite: favorite, + hasDown: hasDown, + hasWatch: hasWatch + } = carNumSets, isFavorite = favorite.has(carNum2), isHasDown = hasDown.has(carNum2), + isHasWatch = hasWatch.has(carNum2), isFiltered = filter.has(carNum2), + isFilterActorMale = actorCarNumToNameMap.has(carNum2), + isFilterActorFemale = actressCarNumToNameMap.has(carNum2), + isFilterActor = isFilterActorMale || isFilterActorFemale, + foundKeyword = filterKeywordList.find((kw => title.includes(kw) || carNum2.startsWith(kw))), + isFilterKeyword = !!foundKeyword; if (!isSearchPage) { let shouldHide = settings.showFavoriteItem === NO && isFavorite || settings.showHasDownItem === NO && isHasDown || settings.showHasWatchItem === NO && isHasWatch || settings.showFilterItem === NO && isFiltered && !(isFavorite || isHasDown || isHasWatch) || settings.showFilterActorItem === NO && isFilterActor || settings.showFilterKeywordItem === NO && isFilterKeyword; if ($box2.attr("data-movieShowType") !== settings.movieShowType) { diff --git a/src/plugins/top250.js b/src/plugins/top250.js index 460922c..1691334 100644 --- a/src/plugins/top250.js +++ b/src/plugins/top250.js @@ -56,9 +56,16 @@ class TOP250Plugin extends BasePlugin { })); } async handleTop() { - if (!window.location.href.includes("handleTop=1")) return; + if (!window.location.href.includes("/rankings/top")) return; const urlParams = new URLSearchParams(window.location.search); - let type = urlParams.get("handleType") || "all", type_value = urlParams.get("type_value") || ""; + let t = urlParams.get("t") || "", type = "all", type_value = ""; + if (/^y\d+$/.test(t)) { + type = "year"; + type_value = t.substring(1); + } else if ("" !== t) { + type = "video_type"; + type_value = t; + } this.has_cnsub = urlParams.get("has_cnsub") || ""; let page = urlParams.get("page") || 1; this.toolBar(type, type_value, page); @@ -80,6 +87,7 @@ class TOP250Plugin extends BasePlugin { const filter_movies = dataList.filter((item => "1" === this.has_cnsub ? item.has_cnsub : "0" !== this.has_cnsub || !item.has_cnsub)); let moviesHtml = javDbApi.markDataListHtml(filter_movies); $movieBox.html(moviesHtml); + this.pluginManager.getBean("ListPagePlugin").doFilter(); } else { clog.error(res); $movieBox.html(`

${message}

`); @@ -101,9 +109,10 @@ class TOP250Plugin extends BasePlugin { $(".pagination-list li a").each((function() { parseInt($(this).text()) > 5 && $(this).closest("li").remove(); })); + const currentTParam = "all" === type ? "" : "year" === type ? `y${type_value}` : type_value; let yearHtml = ""; - for (let year = (new Date).getFullYear(); year >= 2008; year--) yearHtml += `\n \n ${year}\n \n `; - let conditionHtml = `\n
\n \n \n
\n ${yearHtml}\n
\n
\n `; + for (let year = (new Date).getFullYear(); year >= 2008; year--) yearHtml += `\n \n ${year}\n \n `; + let conditionHtml = `\n
\n \n \n
\n ${yearHtml}\n
\n
\n `; this.$contentBox.append(conditionHtml); $("a[data-cnsub-value]").on("click", (event => { const cnsubValue = $(event.currentTarget).data("cnsub-value"); @@ -134,7 +143,8 @@ class TOP250Plugin extends BasePlugin { type = "video_type"; type_value = t; } - let url = `/advanced_search?handleTop=1&handleType=${type}&type_value=${type_value}`; + let tParam = "year" === type ? `y${type_value}` : "all" === type ? "" : type_value; + let url = `/rankings/top${tParam ? `?t=${tParam}` : ""}`; event && (event.ctrlKey || event.metaKey) ? GM_openInTab(window.location.origin + url, { insert: 0 }) : window.location.href = url; @@ -167,7 +177,7 @@ class TOP250Plugin extends BasePlugin { await localStorage.setItem("jhs_appAuthorization", token); show.ok("登录成功"); layer.close(index); - window.location.href = "/advanced_search?handleTop=1&period=daily"; + window.location.href = "/rankings/top"; } } })).catch((err => {