MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / setView

Function setView

deployments/desktop/static/desktop.js:2025–2047  ·  view source on GitHub ↗
(name, updateHash = true, options = {})

Source from the content-addressed store, hash-verified

2023 }
2024
2025 function setView(name, updateHash = true, options = {}) {
2026 state.currentView = name;
2027 document.body.classList.toggle("chat-view", name === "chat");
2028 document.querySelectorAll(".view").forEach((view) => view.classList.toggle("active", view.id === name));
2029 document.querySelectorAll(".rail-item").forEach((button) => button.classList.toggle("active", button.dataset.view === name));
2030 const active = $(name);
2031 if (active) {
2032 updatePageTitle();
2033 }
2034 if (updateHash && window.location.hash.slice(1) !== name) {
2035 history.replaceState(null, "", `${window.location.pathname}${window.location.search}#${name}`);
2036 }
2037 window.scrollTo({ top: 0, left: 0 });
2038 if (name === "reports" && !options.skipLoad) runAction(() => refreshReports({ keepSelection: true }), "加载报告");
2039 if (name === "wiki" && !options.skipLoad) runAction(loadWiki, "加载 Wiki");
2040 if (name === "chat" && !options.skipLoad) runAction(() => loadChatSessions({ openLatest: true }), "加载历史对话");
2041 if (name === "settings") runAction(loadSettings, "加载设置");
2042 if (name === "papers") {
2043 resumeDailyTask().catch((error) => {
2044 console.error(error);
2045 });
2046 }
2047 }
2048
2049 function currentUser() {
2050 return $("userSelect").value || state.currentUser || "user_demo";

Callers 5

openReportFunction · 0.70
submitFeedbackFunction · 0.70
openCitationSourceFunction · 0.70
bindEventsFunction · 0.70
initFunction · 0.70

Calls 6

updatePageTitleFunction · 0.85
loadChatSessionsFunction · 0.85
resumeDailyTaskFunction · 0.85
$Function · 0.70
runActionFunction · 0.70
refreshReportsFunction · 0.70

Tested by

no test coverage detected