|
@@ -59,6 +59,50 @@
|
|
|
return total;
|
|
return total;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function findSummary(root) {
|
|
|
|
|
+ return root.querySelector(".ffkj-page-summary, .page-summary, .edu-page-summary, .vc-page-summary");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function ensureSummary(root, total) {
|
|
|
|
|
+ var summary = findSummary(root);
|
|
|
|
|
+ if (summary) {
|
|
|
|
|
+ if (!/共\s*\d+\s*页/.test(summary.textContent || "")) {
|
|
|
|
|
+ summary.textContent = "共 " + total + " 页";
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (/共\s*\d+\s*页/.test(root.textContent || "")) return;
|
|
|
|
|
+
|
|
|
|
|
+ summary = document.createElement("span");
|
|
|
|
|
+ summary.className = "ffkj-page-summary";
|
|
|
|
|
+ summary.textContent = "共 " + total + " 页";
|
|
|
|
|
+ root.insertBefore(summary, root.firstChild || null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function normalizeSearchPage() {
|
|
|
|
|
+ if (window.location.pathname.replace(/\/+$/, "") !== "/search") return;
|
|
|
|
|
+
|
|
|
|
|
+ document.body.classList.add("ffkj-search-page");
|
|
|
|
|
+ var sidebarSelectors = [
|
|
|
|
|
+ ".department-column-nav",
|
|
|
|
|
+ ".edu-sidebar",
|
|
|
|
|
+ ".inner-side-panel",
|
|
|
|
|
+ ".content-row > .content-left",
|
|
|
|
|
+ ".news-sidebar",
|
|
|
|
|
+ ".inner-sidebar",
|
|
|
|
|
+ ".quick-nav",
|
|
|
|
|
+ ".quick-navigation",
|
|
|
|
|
+ ".side-nav"
|
|
|
|
|
+ ].join(",");
|
|
|
|
|
+
|
|
|
|
|
+ Array.prototype.forEach.call(document.querySelectorAll(sidebarSelectors), function (sidebar) {
|
|
|
|
|
+ var layout = sidebar.parentElement;
|
|
|
|
|
+ if (!layout) return;
|
|
|
|
|
+ layout.classList.add("ffkj-search-single");
|
|
|
|
|
+ sidebar.parentNode.removeChild(sidebar);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function findCurrent(root, total) {
|
|
function findCurrent(root, total) {
|
|
|
var explicit = toPositiveInt(root.getAttribute("data-current-page"));
|
|
var explicit = toPositiveInt(root.getAttribute("data-current-page"));
|
|
|
if (explicit) return explicit;
|
|
if (explicit) return explicit;
|
|
@@ -212,6 +256,8 @@
|
|
|
|
|
|
|
|
if (total <= 1) return;
|
|
if (total <= 1) return;
|
|
|
|
|
|
|
|
|
|
+ ensureSummary(root, total);
|
|
|
|
|
+
|
|
|
var form = document.createElement("form");
|
|
var form = document.createElement("form");
|
|
|
form.className = "ffkj-page-jump";
|
|
form.className = "ffkj-page-jump";
|
|
|
form.setAttribute("role", "search");
|
|
form.setAttribute("role", "search");
|
|
@@ -274,13 +320,14 @@
|
|
|
if (document.querySelector("link[data-ffkj-page-jump-style]")) return;
|
|
if (document.querySelector("link[data-ffkj-page-jump-style]")) return;
|
|
|
var link = document.createElement("link");
|
|
var link = document.createElement("link");
|
|
|
link.rel = "stylesheet";
|
|
link.rel = "stylesheet";
|
|
|
- link.href = "/main/ffkj-portal/pagination-jump.css?v=20261123-all-list-v7";
|
|
|
|
|
|
|
+ link.href = "/main/ffkj-portal/pagination-jump.css?v=20261128-search-pages-r1";
|
|
|
link.setAttribute("data-ffkj-page-jump-style", "true");
|
|
link.setAttribute("data-ffkj-page-jump-style", "true");
|
|
|
document.head.appendChild(link);
|
|
document.head.appendChild(link);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
loadStyle();
|
|
loadStyle();
|
|
|
ready(function () {
|
|
ready(function () {
|
|
|
|
|
+ normalizeSearchPage();
|
|
|
scan();
|
|
scan();
|
|
|
if (!window.MutationObserver) return;
|
|
if (!window.MutationObserver) return;
|
|
|
var timer = 0;
|
|
var timer = 0;
|