1.7 KiB
1.7 KiB
static/js — JS Rules
Profile dropdown — loader model
Profiles are loaders, not persistent modes. Selecting one pushes settings into the sidebar; the sidebar is always the live state.
_setProfileClearBtn(visible)must be called alongside every assignment toS._activeProfileId.- Do not re-add a selectable
value=""option to#profileSelect— deliberately removed in v1.6.6.
Profile editor source panel race condition
_pmgmtSaveFullEdit detects whether Google/file checkboxes have rendered by querying the DOM directly:
const googleRendered = !!document.querySelector('#peSourcesPanel input[data-source-type="google"]');
const fileRendered = !!document.querySelector('#peSourcesPanel input[data-source-type="file"]');
Never revert to !!window._googleConnected / _fileSources.length > 0 — those async proxies can be true before the panel has rendered, silently clearing the user's source selection on save.
Progress bar phase parsing
_setProgressPhase(phase) in scan.js parses the phase string against _PHASE_SOURCE_MAP:
- Source found and
—(em-dash) present → split, resolve via_resolveDisplayName(), updateS._progressCurrentUser. - Source found but no dash → show pill +
S._progressCurrentUser(handles sub-phases like folder counts). - No source match → plain text fallback.
_PHASE_SOURCE_MAP ordering matters — Google Workspace must appear before Gmail in the map. The email regex uses /iu flags — do not drop the i.
Gotchas
- Profile editor accounts — default to unchecked. Only explicitly saved
user_idsare checked. - Date presets — stored as
years * 365(integer days). Do not use* 365.25.