PageSourceSearch

https://dylanbeattie.net/assets/js/main.js

js dylanbeattie.net collected 2026-10-02 03:26:08 UTC 3,672 bytes, 148 lines download raw bytes

1/*
2	Arcana by HTML5 UP
3	html5up.net | @ajlkn
4	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
5*/
6
7(function($) {
8
9	var	$window = $(window),
10		$body = $('body');
11
12	// Breakpoints.
13		breakpoints({
14			wide:	  [ '1281px',  '1680px' ],
15			normal:	[ '981px',   '1280px' ],
16			narrow:	[ '841px',   '980px'  ],
17			narrower:  [ '737px',   '840px'  ],
18			mobile:	[ '481px',   '736px'  ],
19			mobilep:   [ null,	  '480px'  ]
20		});
21
22	// Play initial animations on page load.
23		$window.on('load', function() {
24			window.setTimeout(function() {
25				$body.removeClass('is-preload');
26			}, 100);
27		});
28
29	// Dropdowns.
30		$('#nav > ul').dropotron({
31			offsetY: -15,
32			hoverDelay: 0,
33			alignment: 'center'
34		});
35
36	// Nav.
37
38		// Bar.
39			$(
40				'<div id="titleBar">' +
41					'<a href="#navPanel" class="toggle"></a>' +
42					'<span class="title">' + $('#logo').html() + '</span>' +
43				'</div>'
44			)
45				.appendTo($body);
46
47		// Panel.
48			$(
49				'<div id="navPanel">' +
50					'<nav>' +
51						$('#nav').navList() +
52					'</nav>' +
53				'</div>'
54			)
55				.appendTo($body)
56				.panel({
57					delay: 500,
58					hideOnClick: true,
59					hideOnSwipe: true,
60					resetScroll: true,
61					resetForms: true,
62					side: 'left',
63					target: $body,
64					visibleClass: 'navPanel-visible'
65				});
66
67})(jQuery);
68
69$(function() {
70	const copyToClipboard = (function initClipboardText() {
71		const textarea = document.createElement('textarea');
72	
73		// Move it off screen.
74		textarea.style.cssText = 'position: absolute; left: -99999em';
75	
76		// Set to readonly to prevent mobile devices opening a keyboard when
77		// text is .select()'ed.
78		textarea.setAttribute('readonly', true);
79	
80		document.body.appendChild(textarea);
81	
82		return function setClipboardText(text) {
83			textarea.value = text;
84	
85			// Check if there is any content selected previously.
86			const selected = document.getSelection().rangeCount > 0 ?
87				document.getSelection().getRangeAt(0) : false;
88	
89			// iOS Safari blocks programmtic execCommand copying normally, without this hack.
90			// https://stackoverflow.com/questions/34045777/copy-to-clipboard-using-javascript-in-ios
91			if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {
92				const editable = textarea.contentEditable;
93				textarea.contentEditable = true;
94				const range = document.createRange();
95				range.selectNodeContents(textarea);
96				const sel = window.getSelection();
97				sel.removeAllRanges();
98				sel.addRange(range);
99				textarea.setSelectionRange(0, 999999);
100				textarea.contentEditable = editable;
101			} else {
102				textarea.select();
103			}
104	
105			try {
106				const result = document.execCommand('copy');
107	
108				// Restore previous selection.
109				if (selected) {
110					document.getSelection().removeAllRanges();
111					document.getSelection().addRange(selected);
112				}
113	
114				return result;
115			} catch (err) {
116				return false;
117			}
118		};
119	})();
120
121	$(".clipboard-links a").on("click", function() {
122		$this = $(this);
123		srcElementId = $this.data('src-element-id');
124		srcElement = $("#" + srcElementId);
125		content = srcElement.val();
126		copyToClipboard(content);
127		alert('Copied to clipboard!');
128		return(false);
129	});
130});
131
132$(function() {
133	const playGif = function() {
134		this.src = this.src.replace(/\.png/, '.gif');
135	};
136	const stopGif = function() {
137		this.src = this.src.replace(/\.gif/, '.png');
138	}
139	$("img.animated-gif").one("load", function() {
140		stopGif.call(this);
141		$(this).mouseover(playGif);
142		$(this).mouseout(stopGif);
143	}).each(function() {
144		if(this.complete) $(this).trigger('load');
145	});	
146});
147
148$()

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.