// The only script in the product, two shortcuts inside chapter 25's 2kb, and every page works without it. (function () { function typing(el) { var t = el.tagName; return t === 'INPUT' || t === 'TEXTAREA' || t === 'SELECT' || el.isContentEditable; } document.addEventListener('keydown', function (e) { if (e.metaKey || e.ctrlKey || e.altKey || typing(e.target)) return; if (e.key === '/') { var box = document.querySelector('input[name=q]'); if (box) { box.focus(); box.select(); } else { location.href = '/search'; } e.preventDefault(); return; } if (e.key === 't') { var files = document.querySelector('a[data-files]'); if (files) { location.href = files.getAttribute('href'); e.preventDefault(); } } }); })();