feat(nav): close P0/P1 parity gaps (nav style, history, plate, admin build)
Wire header_nav_style transparent/blur, login history sync, plate publish type, clean dead search CSS, rebuild admin SPA locally (build gitignored).
This commit is contained in:
1 parent
1d1fef50af
commit
0d9db942f8
13 files changed
+181
-85
No files matched your search
@@ -41,6 +41,34 @@
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
|
||||
function saveLoggedHistory(keyword, type) {
|
||||
if (!(window.aksrtData && aksrtData.isLoggedIn) || !ajaxUrl() || !keyword) return;
|
||||
var items = readLocalHistory().filter(function (k) { return k !== keyword; });
|
||||
items.unshift(keyword);
|
||||
items = items.slice(0, 20);
|
||||
// Also update local cache for panel paint consistency.
|
||||
writeLocalHistory(items);
|
||||
var payload =
|
||||
"action=aksrt_search_history&nonce=" +
|
||||
encodeURIComponent(nonce()) +
|
||||
"&mode=save&items=" +
|
||||
encodeURIComponent(
|
||||
JSON.stringify(
|
||||
items.map(function (k) {
|
||||
return { keyword: k, type: type || "post" };
|
||||
})
|
||||
)
|
||||
);
|
||||
try {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", ajaxUrl(), true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||
xhr.send(payload);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
|
||||
function keywordChips(list) {
|
||||
return (list || [])
|
||||
.map(function (kw) {
|
||||
@@ -232,7 +260,9 @@
|
||||
form.addEventListener("submit", function () {
|
||||
var q = (input.value || "").trim();
|
||||
if (!q) return;
|
||||
if (!(window.aksrtData && aksrtData.isLoggedIn)) {
|
||||
if (window.aksrtData && aksrtData.isLoggedIn) {
|
||||
saveLoggedHistory(q, typeValue());
|
||||
} else {
|
||||
var list = readLocalHistory().filter(function (k) {
|
||||
return k !== q;
|
||||
});
|
||||
@@ -297,8 +327,33 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function bindFullSearchBoxHistory() {
|
||||
document.querySelectorAll('form[data-aksrt-search-form="box"]').forEach(function (form) {
|
||||
if (form._aksrtHistBound) return;
|
||||
form._aksrtHistBound = 1;
|
||||
form.addEventListener("submit", function () {
|
||||
var input = form.querySelector('input[name="s"]');
|
||||
var q = input ? (input.value || "").trim() : "";
|
||||
if (!q) return;
|
||||
var typeInput = form.querySelector('input[name="aksrt_search_type"], input[name="type"]');
|
||||
var type = (typeInput && typeInput.value) || "post";
|
||||
if (window.aksrtData && aksrtData.isLoggedIn) {
|
||||
saveLoggedHistory(q, type);
|
||||
} else {
|
||||
var list = readLocalHistory().filter(function (k) {
|
||||
return k !== q;
|
||||
});
|
||||
list.unshift(q);
|
||||
writeLocalHistory(list);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function init() {
|
||||
bindRemoteBoxes(document);
|
||||
bindFullSearchBoxHistory();
|
||||
bindNavbarSearchSlide();
|
||||
var form = document.querySelector('form[data-aksrt-search-form="inline"]');
|
||||
if (form) enhancePanel(form);
|
||||
|
||||
Reference in new issue
Block a user