PageSourceSearch

https://tuky.net/js/demo.js

js tuky.net collected 2026-09-24 11:20:56 UTC 1,098 bytes, 38 lines download raw bytes

1/**
2 * demo.js
3 * http://www.codrops.com
4 *
5 * Licensed under the MIT license.
6 * http://www.opensource.org/licenses/mit-license.php
7 * 
8 * Copyright 2017, Codrops
9 * http://www.codrops.com
10 */
11{
12	setTimeout(() => document.body.classList.add('render'), 60);
13	const navdemos = Array.from(document.querySelectorAll('nav.demos > .demo'));
14	const total = navdemos.length;
15	const current = navdemos.findIndex(el => el.classList.contains('demo--current'));
16	const navigate = (linkEl) => {
17		document.body.classList.remove('render');
18		document.body.addEventListener('transitionend', () => window.location = linkEl.href);
19	};
20	navdemos.forEach(link => link.addEventListener('click', (ev) => {
21		ev.preventDefault();
22		navigate(ev.target);
23	}));
24	document.addEventListener('keydown', (ev) => {
25		const keyCode = ev.keyCode || ev.which;
26		let linkEl;
27		if ( keyCode === 37 ) {
28			linkEl = current > 0 ? navdemos[current-1] : navdemos[total-1];
29		}
30		else if ( keyCode === 39 ) {
31			linkEl = current < total-1 ? navdemos[current+1] : navdemos[0];
32		}
33		else {
34			return false;
35		}
36		navigate(linkEl);
37	});
38}

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.