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:
@@ -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);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
openMenu.classList.remove('is-open');
|
||||
openMenu.setAttribute('hidden', '');
|
||||
openMenu.setAttribute('aria-hidden', 'true');
|
||||
if (openToggle) openToggle.setAttribute('aria-expanded', 'false');
|
||||
if (openToggle && openToggle.setAttribute) openToggle.setAttribute('aria-expanded', 'false');
|
||||
if (openRoot) openRoot.classList.remove('is-open');
|
||||
// Return menu to original root so SSR structure stays consistent.
|
||||
if (openRoot && openMenu.parentNode !== openRoot) {
|
||||
@@ -60,6 +60,11 @@
|
||||
var toggle = root.querySelector('.newadd-btns__toggle');
|
||||
var menu = root.querySelector('.drop-newadd');
|
||||
if (!toggle || !menu) return;
|
||||
if (toggle.tagName === 'SPAN' || toggle.tagName === 'DIV') {
|
||||
toggle.setAttribute('role', 'button');
|
||||
toggle.setAttribute('tabindex', '0');
|
||||
if (!toggle.hasAttribute('aria-expanded')) toggle.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
if (openRoot && openRoot !== root) closeMenu();
|
||||
|
||||
@@ -75,7 +80,7 @@
|
||||
menu.setAttribute('aria-hidden', 'false');
|
||||
menu.classList.add('is-open');
|
||||
root.classList.add('is-open');
|
||||
toggle.setAttribute('aria-expanded', 'true');
|
||||
if (toggle.setAttribute) toggle.setAttribute('aria-expanded', 'true');
|
||||
placeMenu(toggle, menu);
|
||||
}
|
||||
|
||||
@@ -136,6 +141,11 @@
|
||||
var toggle = root.querySelector('.newadd-btns__toggle');
|
||||
var menu = root.querySelector('.drop-newadd');
|
||||
if (!toggle || !menu) return;
|
||||
if (toggle.tagName === 'SPAN' || toggle.tagName === 'DIV') {
|
||||
toggle.setAttribute('role', 'button');
|
||||
toggle.setAttribute('tabindex', '0');
|
||||
if (!toggle.hasAttribute('aria-expanded')) toggle.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
// CSS hover no longer drives this control.
|
||||
root.classList.add('is-js-portal');
|
||||
|
||||
Reference in New Issue
Block a user