PageSourceSearch

https://kyoto.travel/wp-content/themes/kyototravel/assets/js/template/filter.js

js kyoto.travel collected 2026-09-24 08:58:11 UTC 836 bytes, 26 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2	// Get the current filter from the URL
3	const urlParams = new URLSearchParams(window.location.search);
4	const currentFilter = urlParams.get('filter') || 'all';
5
6	const filterRadios = document.querySelectorAll(
7		'.filter-buttons input[type="radio"]'
8	);
9	const filterLabels = document.querySelectorAll('.filter-buttons label');
10
11	filterRadios.forEach((radio) => {
12		if (radio.value === currentFilter) {
13			radio.checked = true;
14		}
15	});
16
17	// Handle clicks on labels to update the URL and aria-checked
18	filterLabels.forEach((label) => {
19		label.addEventListener('click', function () {
20			const filterValue = label.getAttribute('for');
21			const url = new URL(window.location);
22			url.searchParams.set('filter', filterValue);
23			window.location = url.toString();
24		});
25	});
26});

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.