aboutsummaryrefslogtreecommitdiffstats
path: root/theme/default/rsrc/main.js
blob: 164c50f68907d21f85d253980c4c71371cd125f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//==============================================================================
// Elements which contains the location of the previous and next site
//==============================================================================
const prev = document.getElementById("prev-site");
const next = document.getElementById("next-site");

//==============================================================================
// Handle arrow keys and change the location to the desired direction
//==============================================================================
document.addEventListener("keyup", function(e) {
	if(!e.ctrlKey && !e.shiftKey && !e.altKey) {
		(e.keyCode === 37 && prev) && (window.location.href = prev.getAttribute("href"));
		(e.keyCode === 39 && next) && (window.location.href = next.getAttribute("href"));
	}
}, false);