This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm install # Install dependencies
npm run build # Minify src/propsync.js → dist/propsync.js (one-shot)
npm run watch # Same, but re-builds on file save
npm run serve # Static server at localhost:3000 serving dist/No test suite exists. Verify changes manually via debug.html in a browser.
Single-file browser script: src/propsync.js → built to dist/propsync.js via build.js (Terser minification, console.log stripped in prod).
Deployed via jsDelivr CDN pointing at the GitHub repo (rfmarcelino/propsync). Pushing dist/propsync.js to master is the release mechanism — CDN updates within minutes.
The script runs entirely on DOMContentLoaded. No modules, no framework. All state is local to the IIFE-like closure inside the event listener.
The script auto-detects which mode to activate based on DOM classes present:
| Mode | Trigger class | What it does |
|---|---|---|
| Tab filtering | .propsync-tabs |
Generates bedroom tabs, disables checkbox/slider filters |
| Checkbox/slider filtering | .button-filter or filter controls |
Standard filter with optional auto-submit |
| Accordion | .accordion_accordion |
Groups cards by bedroom, clones template per group |
Only one mode runs per page. Tab mode takes priority over checkbox mode.
- Card data lives in the DOM: values like bedroom count and price are read from
.bedroom-card-value,.price-min-card-value, etc. inside each.card-wrapper. - Sold-out detection: price < 0 (e.g.,
-1) signals sold out;markPriceContainerAsSoldOut()swaps in text from.available-sold-out(walking up the DOM to find it). - Availability display:
processAvailabilityWrapper()handles 0 / 1-9 / 9+ counts on.availability-wrapper. - Studio label: bedroom value
0is displayed as "Studio"; siblings containing "Bedroom" text are hidden. - URL param filtering:
?bed=Nauto-applies the matching tab or checkbox on load. - Finsweet conflict: script removes all
fs-cmsfilter-*attributes at startup to prevent Finsweet CMS Filter from interfering. - Cleanup tracking: all
addEventListener,setInterval, andsetTimeoutcalls go through tracked wrappers (addEventListenerWithCleanup, etc.) so thecleanup()function can tear everything down on re-init.
Expects a single template .accordion_accordion with all cards mixed inside. Script:
- Groups
.card-wrapperelements by bedroom count - Clones the template once per bedroom group
- Replaces
{{floor_type}}and{{starting_price}}placeholders in each clone - Hides the original template, inserts clones sorted ascending by bedroom count
Cards can sit directly in .accordion_answer or wrapped in .floorplan-collection-list.
build.jsonly processessrc/propsync.js(hardcoded filter, ignores other.jsfiles insrc/)- Terser config keeps
console.logcalls in source but marks them aspure_funcs(tree-shaken if unused, but present logs survive) - No sourcemaps generated