Skip to content

Commit

Permalink
Small tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreML committed Dec 7, 2023
1 parent 680cd24 commit bfaf903
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions html/create_object.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<form name="spawner" action="byond://?src=/* ref src */" method="get">
<input type="hidden" name="src" value="/* ref src */">
<input type="hidden" name="admin_token" value="/* href token */">
Type: <input type="text" name="filter" onkeypress="submitFirst(event)" style="width:350px"> <input
Type: <input type="text" name="filter" onkeypress="filterKeyPressed(event)" style="width:350px"> <input
type="button" class="button" value="Search" onclick="updateSearch()" /><br>

Offset: <input type="text" name="offset" value="x,y,z" style="width:250px">
Expand Down Expand Up @@ -66,14 +66,19 @@
populateList(filtered);
}

function submitFirst(event) {
if (!object_list.options.length) {
return false;
}

function filterKeyPressed(event) {
// Carriage return
if (event.keyCode == 13 || event.which == 13) {
object_list.options[0].selected = 'true';
// If the value of the input bar is different to the previous search.
if (document.spawner.filter.value != old_search) {
// Search!
updateSearch()
}
// Otherwise, if there are entries in the object list.
else if (object_list.options.length){
// Select and spawn the one at the top.
object_list.options[0].selected = 'true';
}
}
}
</script>
Expand Down

0 comments on commit bfaf903

Please sign in to comment.