diff options
-rw-r--r-- | opennhrp-editinterface-html.lsp | 15 | ||||
-rw-r--r-- | opennhrp-model.lua | 5 |
2 files changed, 19 insertions, 1 deletions
diff --git a/opennhrp-editinterface-html.lsp b/opennhrp-editinterface-html.lsp index 73af9ab..67898e7 100644 --- a/opennhrp-editinterface-html.lsp +++ b/opennhrp-editinterface-html.lsp @@ -2,6 +2,21 @@ require("viewfunctions") %> +<script type="text/javascript" src="/js/jquery-latest.js"></script> +<script type="text/javascript"> + function enabledisable(){ + if ($("[name='type']").val() == "NHRP Enabled") { + $("[name='map']").attr("disabled", ""); + } else { + $("[name='map']").attr("disabled", "disabled"); + } + } + $(function(){ + $("[name='type']").change(enabledisable); + enabledisable(); + }); +</script> + <H1><%= form.label %></H1> <% form.value.interface.contenteditable = false diff --git a/opennhrp-model.lua b/opennhrp-model.lua index ef9c69a..78338f9 100644 --- a/opennhrp-model.lua +++ b/opennhrp-model.lua @@ -52,7 +52,10 @@ local function parseconfigfile(configfilecontent) local currentinterface local words = {} - for word in configfilecontent:gmatch("%S+") do words[#words + 1] = word end + -- remove comments, and then parse word-by-word + for word in string.gmatch(string.gsub(configfilecontent, "#[^\n]*", ""), "%S+") do + words[#words + 1] = word + end local i=1 while i <= table.maxn(words) do local word = words[i] |