// Usage: assuming you have commit snapshots set up and building for your spec, include a link like // `Snapshot as of this commit`. // // Then include this script with // ``. (function () { 'use strict'; document.addEventListener('DOMContentLoaded', function () { var keyCode = 'Y'.charCodeAt(0); var snapshotLink = document.querySelector('a#commit-snapshot-link'); var snapshotUrl = snapshotLink.href; snapshotLink.title = 'You can also press the \'y\' key'; window.addEventListener('keydown', function (e) { if (e.keyCode === keyCode) { location.href = snapshotUrl + location.hash; } }); }); }());