mirror of
https://github.com/fireinrain/JHS-enhance.git
synced 2026-10-14 13:26:37 +08:00
修复排行榜
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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('<div class="movie-list h cols-4 vcols-8" style="margin-top: 10px"></div>');
|
||||
}
|
||||
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 <div class="button-group" style="margin-top:18px">\n <div class="buttons has-addons" id="conditionBox">\n <a style="padding:18px 18px !important;" class="button is-small ${"daily" === period ? "is-info" : ""}" href="/advanced_search?handlePlayback=1&period=daily">日榜</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"weekly" === period ? "is-info" : ""}" href="/advanced_search?handlePlayback=1&period=weekly">周榜</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"monthly" === period ? "is-info" : ""}" href="/advanced_search?handlePlayback=1&period=monthly">月榜</a>\n </div>\n </div>\n `;
|
||||
let conditionHtml = `\n <div class="button-group" style="margin-top:18px">\n <div class="buttons has-addons" id="conditionBox">\n <a style="padding:18px 18px !important;" class="button is-small ${"daily" === period ? "is-info" : ""}" href="/rankings/playback?period=daily">日榜</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"weekly" === period ? "is-info" : ""}" href="/rankings/playback?period=weekly">周榜</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"monthly" === period ? "is-info" : ""}" href="/rankings/playback?period=monthly">月榜</a>\n </div>\n </div>\n `;
|
||||
this.$contentBox.append(conditionHtml);
|
||||
}
|
||||
getStarRating(score) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+16
-6
@@ -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(`<h3>${message}</h3>`);
|
||||
@@ -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 <a style="padding:18px 18px !important;" \n class="button is-small ${type_value === year.toString() ? "is-info" : ""}" \n href="/advanced_search?handleTop=1&handleType=year&type_value=${year}&has_cnsub=${this.has_cnsub}">\n ${year}\n </a>\n `;
|
||||
let conditionHtml = `\n <div class="button-group">\n <div class="buttons has-addons" id="conditionBox" style="margin-bottom: 0!important;">\n <a style="padding:18px 18px !important;" class="button is-small ${"all" === type ? "is-info" : ""}" href="/advanced_search?handleTop=1&handleType=all&type_value=&has_cnsub=${this.has_cnsub}">全部</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"0" === type_value ? "is-info" : ""}" href="/advanced_search?handleTop=1&handleType=video_type&type_value=0&has_cnsub=${this.has_cnsub}">有码</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"1" === type_value ? "is-info" : ""}" href="/advanced_search?handleTop=1&handleType=video_type&type_value=1&has_cnsub=${this.has_cnsub}">无码</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"2" === type_value ? "is-info" : ""}" href="/advanced_search?handleTop=1&handleType=video_type&type_value=2&has_cnsub=${this.has_cnsub}">欧美</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"3" === type_value ? "is-info" : ""}" href="/advanced_search?handleTop=1&handleType=video_type&type_value=3&has_cnsub=${this.has_cnsub}">Fc2</a>\n \n <a style="padding:18px 18px !important;margin-left: 50px" class="button is-small ${"1" === this.has_cnsub ? "is-info" : ""}" data-cnsub-value="1">含中字磁鏈</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"0" === this.has_cnsub ? "is-info" : ""}" data-cnsub-value="0">无字幕</a>\n <a style="padding:18px 18px !important;" class="button is-small" data-cnsub-value="">重置</a>\n </div>\n \n <div class="buttons has-addons" id="conditionBox">\n ${yearHtml}\n </div>\n </div>\n `;
|
||||
for (let year = (new Date).getFullYear(); year >= 2008; year--) yearHtml += `\n <a style="padding:18px 18px !important;" \n class="button is-small ${type_value === year.toString() ? "is-info" : ""}" \n href="/rankings/top?t=y${year}&has_cnsub=${this.has_cnsub}">\n ${year}\n </a>\n `;
|
||||
let conditionHtml = `\n <div class="button-group">\n <div class="buttons has-addons" id="conditionBox" style="margin-bottom: 0!important;">\n <a style="padding:18px 18px !important;" class="button is-small ${"all" === type ? "is-info" : ""}" href="/rankings/top?has_cnsub=${this.has_cnsub}">全部</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"0" === type_value ? "is-info" : ""}" href="/rankings/top?t=0&has_cnsub=${this.has_cnsub}">有码</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"1" === type_value ? "is-info" : ""}" href="/rankings/top?t=1&has_cnsub=${this.has_cnsub}">无码</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"2" === type_value ? "is-info" : ""}" href="/rankings/top?t=2&has_cnsub=${this.has_cnsub}">欧美</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"3" === type_value ? "is-info" : ""}" href="/rankings/top?t=3&has_cnsub=${this.has_cnsub}">Fc2</a>\n \n <a style="padding:18px 18px !important;margin-left: 50px" class="button is-small ${"1" === this.has_cnsub ? "is-info" : ""}" data-cnsub-value="1">含中字磁鏈</a>\n <a style="padding:18px 18px !important;" class="button is-small ${"0" === this.has_cnsub ? "is-info" : ""}" data-cnsub-value="0">无字幕</a>\n <a style="padding:18px 18px !important;" class="button is-small" data-cnsub-value="">重置</a>\n </div>\n \n <div class="buttons has-addons" id="conditionBox">\n ${yearHtml}\n </div>\n </div>\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 => {
|
||||
|
||||
Reference in New Issue
Block a user