This repository has been archived on 2023-09-23. You can view files and clone it, but cannot push or open issues or pull requests.
newtabber/template/footer.html

26 lines
818 B
HTML
Raw Permalink Normal View History

2022-11-23 12:00:14 -06:00
</section>
<section>
2023-09-21 07:43:24 -05:00
<form id='sform' method='get' action='https://kagi.com/search'>
<input type='text' id='search' name='q' placeholder='Search' autocomplete='off'>
2022-11-23 12:00:14 -06:00
</form>
</section>
</main>
<script>
document.addEventListener('DOMContentLoaded', () => {
const s = document.getElementById('search');
document.getElementById('sform').addEventListener('submit', (e) => {
let term = s.value;
if (/^[^\s]+\.(com|net|org|ca|us|io|ai|cr|gov)(\/[^\s]*)?$/.test(term)) {
2022-11-23 12:00:14 -06:00
e.preventDefault();
if (!/^https?:\/\//.test(term)) {
term = 'https://' + term;
}
window.location.replace(term);
}
});
s.focus();
});
</script>
</body>
</html>