PageSourceSearch

https://zerowaste.org/assets/controllers/map_mode_controller-4b52e01a.js

js zerowaste.org collected 2026-09-26 00:00:18 UTC 735 bytes, 20 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3// The map's get/shed switch.
4//
5// Unlike the category pills, this reloads: "getting stuff" and "getting rid of stuff"
6// are two different sets of places, filtered in SQL, not two views of one set. Putting
7// the mode in the URL also means a link to one side of the map stays on that side.
8//
9// Listens on the wrapper rather than on each segment, so SegmentedControlComponent
10// keeps rendering plain buttons.
11export default class extends Controller {
12  switch(event) {
13    const button = event.target.closest("button[value]")
14    if (!button) return
15
16    const url = new URL(window.location.href)
17    url.searchParams.set("mode", button.value)
18    Turbo.visit(url.toString())
19  }
20}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.