27 lines
812 B
HTML
27 lines
812 B
HTML
|
</ul>
|
||
|
</section>
|
||
|
<section>
|
||
|
<form id='sform' method='post' action='https://s.rdsm.ca/search'>
|
||
|
<input type='text' id='search' name='q' placeholder='Search'>
|
||
|
</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|cr|gov)(\/[^\s]*)?$/.test(term)) {
|
||
|
e.preventDefault();
|
||
|
if (!/^https?:\/\//.test(term)) {
|
||
|
term = 'https://' + term;
|
||
|
}
|
||
|
window.location.replace(term);
|
||
|
}
|
||
|
});
|
||
|
s.focus();
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|