# GeoLynx - Unused Files Pass 2

Working checklist. Verified against the current `load_file()` routing and grepped across all `www/js/*.js` and `www/html/*.php`.

---

## Summary

| Category | Count | Notes |
|---|---|---|
| Unused JS files (`www/js/`) | 18 | Mostly FA/Bootstrap local duplicates |
| Legacy-only JS (old routes) | 3 | Still accessible via `*old` URLs |
| Unused fn/ endpoints | 3 | Zero references in JS or HTML |
| index.php CDN libraries to remove | 5 | No uses in any active JS file |
| index.php CDN duplicates/review | 2 | Double-loaded or single use |

---

## Unused JS files (`www/js/`)

### Not routed

- [x] `www/js/map.js` — old map page JS; the `map` route now loads `map_v5.js`. Only reference is a commented-out `<script>` tag in `index.php`. **HIGH**
- [x] `www/js/leaflet.js` — local copy of Leaflet; Leaflet is served from CDN in `index.php`. Not referenced anywhere else. **HIGH**
- [x] `www/js/leaflet.canvas-markers.js` — no references in any PHP, HTML, or JS file. **HIGH**
- [ ] `www/js/accounts.js` — loaded by the `verify` and `account` routes, but those routes reference `partials/accounts.html.php` which does not exist. Both routes are broken stubs. **MEDIUM**
- [x] `www/js/planner.js` — loaded by the `planner` route but the file contains no content. Confirm the planner feature is abandoned before deleting the route too. **MEDIUM**

### Font Awesome local subsets (redundant — `all.js` is the file loaded in `index.php`)

- [ ] `www/js/all.min.js` — **HIGH**
- [x] `www/js/brands.js` — **HIGH**
- [x] `www/js/brands.min.js` — **HIGH**
- [x] `www/js/fontawesome.js` — **HIGH**
- [x] `www/js/fontawesome.min.js` — **HIGH**
- [x] `www/js/regular.js` — **HIGH**
- [x] `www/js/regular.min.js` — **HIGH**
- [x] `www/js/solid.js` — **HIGH**
- [x] `www/js/solid.min.js` — **HIGH**
- [x] `www/js/v4-shims.js` — **HIGH**
- [x] `www/js/v4-shims.min.js` — **HIGH**

### Bootstrap local variants (redundant — only `bootstrap.bundle.min.js` is served)

- [ ] `www/js/bootstrap.bundle.js` — unminified duplicate. **HIGH**
- [x] `www/js/bootstrap.esm.js` — ESM build, not used. **HIGH**
- [x] `www/js/bootstrap.esm.min.js` — ESM build, not used. **HIGH**
- [ ] `www/js/bootstrap.js` — standalone build, not used. **HIGH**

---

## Unused CSS files (`www/css/`)

### Font Awesome subsets (redundant — `all.css` is the file loaded in `index.php`)

- [x] `www/css/all.min.css` — **HIGH**
- [x] `www/css/brands.css` — **HIGH**
- [x] `www/css/brands.min.css` — **HIGH**
- [x] `www/css/fontawesome.css` — **HIGH**
- [x] `www/css/fontawesome.min.css` — **HIGH**
- [x] `www/css/regular.css` — **HIGH**
- [x] `www/css/regular.min.css` — **HIGH**
- [x] `www/css/solid.css` — **HIGH**
- [x] `www/css/solid.min.css` — **HIGH**
- [x] `www/css/svg-with-js.css` — FA SVG+JS mode, not used. **HIGH**
- [x] `www/css/svg-with-js.min.css` — **HIGH**
- [x] `www/css/v4-shims.css` — **HIGH**
- [x] `www/css/v4-shims.min.css` — **HIGH**

### Bootstrap CSS variants (redundant — only `bootstrap.min.css` is served, via `index.php`)

- [ ] `www/css/bootstrap.css` — unminified duplicate. **HIGH**
- [x] `www/css/bootstrap.rtl.css` — RTL build, not used. **HIGH**
- [x] `www/css/bootstrap.rtl.min.css` — **HIGH**
- [x] `www/css/bootstrap-grid.css` — grid-only build, not used. **HIGH**
- [x] `www/css/bootstrap-grid.min.css` — **HIGH**
- [x] `www/css/bootstrap-grid.rtl.css` — **HIGH**
- [x] `www/css/bootstrap-grid.rtl.min.css` — **HIGH**
- [x] `www/css/bootstrap-reboot.css` — reboot-only build, not used. **HIGH**
- [x] `www/css/bootstrap-reboot.min.css` — **HIGH**
- [x] `www/css/bootstrap-reboot.rtl.css` — **HIGH**
- [x] `www/css/bootstrap-reboot.rtl.min.css` — **HIGH**
- [x] `www/css/bootstrap-utilities.css` — utilities-only build, not used. **HIGH**
- [x] `www/css/bootstrap-utilities.min.css` — **HIGH**
- [x] `www/css/bootstrap-utilities.rtl.css` — **HIGH**
- [x] `www/css/bootstrap-utilities.rtl.min.css` — **HIGH**x
### Leaflet CSS (redundant — Leaflet served from CDN, and Leaflet itself is unused)

- [x] `www/css/leaflet.css` — local copy; Leaflet is loaded from CDN and is itself unused (all usage is dead code). **HIGH**

### Legacy page CSS

- [x] `www/css/map.css` — loaded by the old `map` route stub which previously loaded `map.js` (also deleted). No longer referenced. **HIGH**

---

## Legacy-route JS (old routes still accessible via URL)

These files are loaded by `*old` routes in `load_file()` (`projecteditold`, `accounteditold`, `distanceanalysistoolold`). They're not reachable from the UI but aren't dead code while those routes exist. Consider removing the routes and files together.

- [x] `www/js/project.js` — only route: `projecteditold`. Uses Leaflet (not OL). **MEDIUM**
- [x] `www/js/account_edit.js` — only route: `accounteditold`. Uses OL. **MEDIUM**
- [x] `www/js/strategy.js` — only route: `distanceanalysistoolold`. **MEDIUM**

---

## Unused fn/ endpoints

No references found in any JS or HTML file (grep across all of `www/js/*.js` and `www/html/*.php`).

- [x] `www/fn/reports_chart_get.php` — zero references anywhere. Possibly a server-side data endpoint that was never wired to a UI. **HIGH**
- [x] `www/fn/insights_load.php` — zero references anywhere. **HIGH**
- [ ] `www/fn/file_upload_v2.php` — zero references; `file_upload.php` is used instead by all active file upload JS. **HIGH**

---

## index.php — CDN libraries to remove

These are loaded globally on every page but have zero uses in any active JS file.

- [x] **Leaflet CSS + JS** (CDN) — `leaflet.css` and `leaflet.js`. All `L.*` usage in `project_edit_v2.js` is inside `mapProjectDetail()`, which is only called from a commented-out line in `main.js`. Zero active usage. **HIGH**
- [x] **Leaflet-Geoman CSS + JS** (CDN) — all `.pm.*` usage is also inside the same dead `mapProjectDetail()` function. **HIGH**
- [x] **Leaflet-GeometryUtil** — `leaflet-geometryutil@0.10.2` CDN script. `L.GeometryUtil` not referenced in any JS file. **HIGH**
- [x] **Leaflet-AlmostOver** — `leaflet-almostover@1.0.1` CDN script. Not referenced in any JS file. **HIGH**
- [ ] **cytoscape-dagre** — `cytoscape-dagre@2.5.0` CDN script. Layouts used are `breadthfirst`, `cose` (both built-in), and `fcose` (plugin). `dagre` is never referenced. **HIGH**

---

## index.php — CDN issues to review

- [x] **cytoscape-fcose loaded twice** — both `https://unpkg.com/cytoscape-fcose/cytoscape-fcose.js` (unversioned) and `https://cdn.jsdelivr.net/npm/cytoscape-fcose@2.2.0/cytoscape-fcose.min.js` are loaded. fcose IS used (`name: 'fcose'` in `project_edit_v2.js`). Remove the unversioned unpkg copy, keep the versioned jsdelivr one. **HIGH**
- [ ] **D3.js** — only used in `login.js` for a single `d3.Delaunay.from()` call (postcode nearest-point lookup on the login page). D3 is a large library (~300KB) for one function. Not unused, but worth replacing with a lighter alternative or inlining the Delaunay logic. **MEDIUM**

---

## Library usage reference

For context on what IS in use:

| Library | Used in | Notes |
|---|---|---|
| **Leaflet** (CDN) | `project_edit_v2.js` | Mini-maps in project editor; Geoman drawing tools also active |
| **Leaflet-Geoman** | `project_edit_v2.js` | `.pm.` draw controls used |
| **OpenLayers** (`lib/ol/`) | `map_v5.js`, `project_edit_v2.js`, `stocklist_edit.js`, `opportunity_edit.js`, `account_edit_v2.js`, `wayleave_edit_v2.js`, `companalysis.js`, `account_edit.js` | Primary map engine |
| **Cytoscape** | `project_edit_v2.js` | Network topology tab |
| **cytoscape-node-html-label** | `project_edit_v2.js` | Custom node labels |
| **cytoscape-popper + @popperjs/core** | `project_edit_v2.js` | Edge/node tooltip positioning |
| **cytoscape-fcose** | `project_edit_v2.js` | `name: 'fcose'` layout |
| **layout-base + cose-base** | Dependencies of fcose | Keep alongside fcose |
| **Chart.js** | `dashboard.js`, `reports.js` | Charts |
| **Bootstrap Table** | Many list pages | Data tables |
| **Bootstrap Table Export ext.** | Many list pages | Export buttons via `data-show-export` |
| **SheetJS** | `project_edit_v2.js`, `stocklist_edit.js`, `project_list.js`, `js_strategy_distancetool.js` | Implicit — Tabulator calls `window.XLSX` for `.download("xlsx", ...)`. Must be kept even though app code doesn't reference `XLSX` directly. |
| **Feather Icons** | `reports.js` | Icon rendering |
| **jQuery + jQuery UI** | `main.js`, `map_v5.js`, `wayleave_edit_v2.js` | Autocomplete, draggable |
| **Tabulator** | Multiple edit pages | Rich data tables |
| **D3** | `login.js` | Delaunay triangulation (postcode lookup) |

>Actioned/Updated 25/06/2026
> 
>Some files not removed at this stage, possible to remove later. 