Docs polish: active-pill sync, license-sidebar bug fix, pricing standardized, ~70 em-dashes removed
- docs.js (new): sync sidebar .active pill with location.hash on load, click, and hashchange so in-page anchor links (Architecture, Discount codes, Backups, etc.) update the pill instead of leaving it stuck on whatever was statically marked - Wire docs.js into every page just before </body> - license.html: sidebar Project/Operate order matches every other page (Project first) - pricing.html: rewritten to use the standard docs layout (full sidebar groups, prose main, breadcrumb) instead of a one-off shell that felt detached from the rest of the docs - Reference section: remove Admin API + SDKs anchor links (they masqueraded as separate pages but just scrolled within integrate.html); Wire format stands alone - Pricing copy: Zaprite reframed as "expanded payment options including card payment capabilities", "shipping in v0.3" removed (it shipped), Patron rephrased as perpetual (never expires or renews) - "Toggling inactive" cap-evasion language replaced — admin UI exposes delete only, no soft-disable affordance for products - ~70 em-dashes removed across 8 pages using a small pattern set (elaboration→period, list-intro→colon, tight clarification→comma, parentheticals→parens). Decorative stamp ornaments and references to actual third-party UI labels are kept verbatim.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
// Shared docs-site behaviors. Loaded at the bottom of every page.
|
||||
//
|
||||
// Sidebar active-pill sync: the .active class on sidebar links is
|
||||
// baked into each HTML file as a baseline (page-level link only),
|
||||
// which means clicking an in-page anchor link (e.g. "Discount codes"
|
||||
// → index.html#discounts) leaves the pill stuck on whatever the
|
||||
// statically-marked page link was. This script keeps the active
|
||||
// state in sync with the current URL hash so the pill follows
|
||||
// what the user clicked.
|
||||
(function () {
|
||||
var sidebarLinks = Array.prototype.slice.call(
|
||||
document.querySelectorAll('aside.side a')
|
||||
);
|
||||
if (!sidebarLinks.length) return;
|
||||
|
||||
var currentFile = (location.pathname.split('/').pop() || 'index.html');
|
||||
|
||||
function findActive(hash) {
|
||||
var desired = hash ? (currentFile + hash) : currentFile;
|
||||
var match = null;
|
||||
sidebarLinks.forEach(function (a) {
|
||||
if (a.getAttribute('href') === desired) match = a;
|
||||
});
|
||||
if (match) return match;
|
||||
// Fallback: bare current-file link when no hash matches
|
||||
sidebarLinks.forEach(function (a) {
|
||||
if (a.getAttribute('href') === currentFile) match = a;
|
||||
});
|
||||
return match;
|
||||
}
|
||||
|
||||
function setActive(link) {
|
||||
if (!link) return;
|
||||
sidebarLinks.forEach(function (a) { a.classList.remove('active'); });
|
||||
link.classList.add('active');
|
||||
}
|
||||
|
||||
setActive(findActive(location.hash));
|
||||
|
||||
window.addEventListener('hashchange', function () {
|
||||
setActive(findActive(location.hash));
|
||||
});
|
||||
|
||||
sidebarLinks.forEach(function (a) {
|
||||
a.addEventListener('click', function () {
|
||||
setActive(a);
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user