summaryrefslogtreecommitdiffstats
path: root/template/standard/rsrc/main.js
blob: f73d061bb3f49a5a8294c99e8a4b11942ea3d0b4 (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);