Mercurial > hg > batmud > chester
changeset 8:5e1cdf22d647
Cleanups, fixes, added a global "reset" button.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 10 Jan 2011 06:58:14 +0200 |
parents | 6ff1ee9122b2 |
children | da404b8ff282 |
files | index.php |
diffstat | 1 files changed, 24 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/index.php Mon Jan 10 06:43:45 2011 +0200 +++ b/index.php Mon Jan 10 06:58:14 2011 +0200 @@ -227,6 +227,7 @@ <!-- <input type="button" value=" Create TinyFugue Macros " onclick="createInit('tf');" /> --> <input type="button" value=" Create SAVEBLOB " onclick="createInit('save');" /> + <input type="button" value=" Reset " onclick="resetAll();" /> </p> @@ -379,7 +380,6 @@ } --> <? - function getContainerObject($name, $slots, $items) { return "new Container(\"".$name."\", \"".$slots."\", [".getJSArraySegment($items)."])"; @@ -393,12 +393,29 @@ } } -echo -"var list_containers = [".$str."];\n". -"var list_items = ".(isset($data["items"]) ? getContainerObject("items", 10000, $data["items"]) : "null").";\n"; +echo " +var list_containers; +var list_items; + +function initAll() +{ + list_containers = [".$str."]; + list_items = ".(isset($data["items"]) ? getContainerObject("items", 10000, $data["items"]) : "null")."; + updatePage(); +} +"; ?> -<!-- #kludge --><!-- +<!-- kludge --><!-- + +function resetAll() +{ + var answer = confirm("Really delete all defined containers and reset item pool to original state?"); + if (!answer) { + statusMsg("Reset operation cancelled."); + return; + } +} function setHTML(id, str) { @@ -724,7 +741,7 @@ if (mode == "batmud") { if (cmd_seq) { - s += expandCmd(cmd_cmd, tmp, container.name) + cmd_delim; + s += expandCmd(cmd_cmd, tmp, container.name) + "\n"; } else { if (s != "") s += ","; s += tmp; @@ -753,7 +770,7 @@ o.innerHTML = str; } -updatePage(); +initAll(); --> </script> <?