add javascript
This commit is contained in:
parent
6ca036c577
commit
a5f73c1b0c
32
index.html
32
index.html
@ -180,5 +180,37 @@
|
|||||||
<a href="https://git.tsugutsugugo.com/explore/repos">Source</a> | <a href="https://docs.tsugutsugugo.com/">Docs</a>
|
<a href="https://git.tsugutsugugo.com/explore/repos">Source</a> | <a href="https://docs.tsugutsugugo.com/">Docs</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Wait until the DOM is fully loaded
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const form = document.querySelector('.search-form');
|
||||||
|
|
||||||
|
form.addEventListener('submit', function(e) {
|
||||||
|
// Get which radio button is checked
|
||||||
|
const selectedValue = document.querySelector('input[name="category"]:checked').value;
|
||||||
|
|
||||||
|
// Change the form's action based on the selected category
|
||||||
|
switch (selectedValue) {
|
||||||
|
case 'science':
|
||||||
|
e.target.action = 'https://science.tsugutsugugo.com/yacysearch.html?query={}';
|
||||||
|
break;
|
||||||
|
case 'philosophy':
|
||||||
|
e.target.action = 'https://sophos.tsugutsugugo.com/yacysearch.html?query={}';
|
||||||
|
break;
|
||||||
|
case 'tech':
|
||||||
|
e.target.action = 'https://tech.tsugutsugugo.com/yacysearch.html?query={}';
|
||||||
|
break;
|
||||||
|
case 'discover':
|
||||||
|
e.target.action = 'https://web.tsugutsugugo.com/yacysearch.html?query={}';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// fallback to science
|
||||||
|
e.target.action = 'https://science.tsugutsugugo.com/yacysearch.html?query={}';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user