mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
- Phone viewer: Contents menu for README headings, theme toggle in the header, GitHub icon on sign-in, 12px Ace font - File ⋯ menu: file details line, Find for HTML, View raw, Download ZIP, Copy file path - Redaction slots inside highlighted code blocks; fix regex lastIndex reuse in the redaction walker - Landing and FAQ copy: plainer headings, trust items, closing CTA band - Explorer ZIP button label, snapshot text cleanup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
3.2 KiB
JavaScript
65 lines
3.2 KiB
JavaScript
import { computed } from "vue";
|
|
|
|
// Local state formerly initialized by templates; list aliases are computed.
|
|
export function initializeTemplate(name, state) {
|
|
if (name === "partials/explorer.htm") {
|
|
state.sidebarCollapsed = window.matchMedia?.("(max-width: 767px)").matches || false;
|
|
state.sidebarHidden = false;
|
|
state.dirExpanded = false;
|
|
state.moreOpen = false;
|
|
state.tocOpen = false;
|
|
state.mdFindOpen = false;
|
|
state.mdFindQuery = "";
|
|
state.mdFindTotal = 0;
|
|
state.mdFindIndex = 0;
|
|
state.mdFindCase = false;
|
|
state.accountOpen = false;
|
|
state.helpOpen = false;
|
|
state.sidebarWidth = Math.min(520, Math.max(220, Number(localStorage.getItem("sidebarWidth")) || 280));
|
|
// Shared with the app bar so the brand column lines up with the file tree.
|
|
document.documentElement.style.setProperty("--sidebar-w", state.sidebarWidth + "px");
|
|
state.startSidebarResize = (event) => {
|
|
event.preventDefault();
|
|
const startX = event.clientX;
|
|
const startWidth = state.sidebarWidth;
|
|
const move = (e) => {
|
|
state.sidebarWidth = Math.min(520, Math.max(220, startWidth + e.clientX - startX));
|
|
document.documentElement.style.setProperty("--sidebar-w", state.sidebarWidth + "px");
|
|
};
|
|
const up = () => {
|
|
window.removeEventListener("pointermove", move);
|
|
window.removeEventListener("pointerup", up);
|
|
document.body.classList.remove("is-resizing");
|
|
localStorage.setItem("sidebarWidth", String(state.sidebarWidth));
|
|
};
|
|
document.body.classList.add("is-resizing");
|
|
window.addEventListener("pointermove", move);
|
|
window.addEventListener("pointerup", up);
|
|
};
|
|
}
|
|
if (name === "partials/anonymize.htm") {
|
|
state.prTabState = { active: state.options.diff ? "diff" : "comments" };
|
|
state.watchGroup(["options.diff", "options.comments"], () => {
|
|
if (!state.options[state.prTabState.active]) state.prTabState.active = state.options.diff ? "diff" : state.options.comments ? "comments" : null;
|
|
});
|
|
}
|
|
if (name === "partials/gist.htm") state.tabState = { active: state.details?.files ? "files" : "comments" };
|
|
if (["partials/conferences.htm", "partials/conference.htm"].includes(name)) {
|
|
state.statusLabels = { ready: "Ready", expired: "Expired", removed: "Removed" };
|
|
}
|
|
const lists = {
|
|
"partials/dashboard.htm": ["filteredItems", () => state.items, "itemFilter"],
|
|
"partials/conferences.htm": ["filteredConferences", () => state.conferences, "conferenceFilter"],
|
|
"partials/conference.htm": ["filteredRepositories", () => state.conference?.repositories, "repoFiler"],
|
|
"partials/admin/repositories.htm": ["filteredRepositories", () => state.repositories, "repoFiler"],
|
|
"partials/admin/user.htm": ["filteredRepositories", () => state.repositories, "repoFiler"],
|
|
"partials/admin/users.htm": ["filteredUsers", () => state.users, "userFiler"],
|
|
"partials/admin/conferences.htm": ["filteredConferences", () => state.conferences],
|
|
};
|
|
const list = lists[name];
|
|
if (list) {
|
|
const value = computed(() => state.fmt.orderBy(state.fmt.filter(list[1](), state[list[2]]), state.orderBy));
|
|
Object.defineProperty(state, list[0], { configurable: true, get: () => value.value });
|
|
}
|
|
}
|