Made create-object faster and added a search button. (you can't use regexes in the search anymore, if you used this feel free to rage at me)

Signed-off-by: Mloc <colmohici@gmail.com>
This commit is contained in:
Mloc
2012-04-30 19:19:02 +01:00
parent e8deceaed5
commit c9aecaab0d
3 changed files with 7 additions and 12 deletions

View File

@@ -27,7 +27,7 @@
<form name="spawner" action="byond://?src=/* ref src */" method="get">
<input type="hidden" name="src" value="/* ref src */">
Type <input type="text" name="filter" value="" onkeyup="updateSearch()" onkeypress="submitFirst(event)" style="width:350px"><br>
Type <input type="text" name="filter" value="" onkeypress="submitFirst(event)" style="width:350px"> <input type = "button" value = "Search" onclick = "updateSearch()" /><br>
Offset: <input type="text" name="offset" value="x,y,z" style="width:250px">
A <input type="radio" name="offset_type" value="absolute">
@@ -44,13 +44,13 @@
</select>
<br><br>
<select name="object_list" id="object_list" size="18" multiple style="width:98%"></select><br>
<input type="submit" value="spawn">
<input type="submit" value="Spawn">
</form>
<script language="JavaScript">
var old_search = "";
var object_list = document.spawner.object_list;
var object_paths = null /* object types */;
var object_paths = //null /* object types */;
var objects = object_paths == null ? new Array() : object_paths.split(";");
document.spawner.filter.focus();
@@ -72,19 +72,12 @@
function updateSearch()
{
if (old_search == document.spawner.filter.value)
{
return;
}
old_search = document.spawner.filter.value;
var filtered = new Array();
var i;
for (i in objects)
for(var i in objects)
{
if(objects[i].search(old_search) < 0)
if(objects[i].indexOf(old_search) < 0)
{
continue;
}