diff --git a/editor/sahliedit.js b/editor/sahliedit.js index dbc6a6b..00b93e7 100644 --- a/editor/sahliedit.js +++ b/editor/sahliedit.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 1.7.1 (function() { - var Sahli, ansiorascii, arraytocolor, booltoint, colortoarray, colortoname, dec2hex, dumpjson, hex2dec, inttobool, loadsahli, newsahli, statustobool; + var Sahli, ansiorascii, arraytocolor, booltoint, colortoarray, colortoname, dec2hex, dumpjson, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, statustobool; $(function() { return $("h1").hide().slideDown(500); @@ -231,6 +231,8 @@ $("#entryindex").val(pos); $("#entryname").val(data.name); $("#entryauthor").val(data.author); + $("#entryfiletpye").val(data.filetype); + $("#entryfiletype").children()[resolvefiletype(data.filetype)].selected = true; $("#entryamiga").val(data.amiga); $("#entryamiga").children()[1].textContent = ansiorascii(data.amiga); $("#entryfont").val(data.font); @@ -267,6 +269,23 @@ } }; + resolvefiletype = function(filetype) { + var options; + options = { + "plain": 0, + "ansi": 1, + "xbin": 2, + "ice": 3, + "adf": 4, + "avatar": 5, + "bin": 6, + "idf": 7, + "pcboard": 8, + "tundra": 9 + }; + return options[filetype]; + }; + ansiorascii = function(status) { if (status === 0) { return "Ansi"; diff --git a/editor/sahliedit.litcoffee b/editor/sahliedit.litcoffee index 34034c5..1dfe1d0 100644 --- a/editor/sahliedit.litcoffee +++ b/editor/sahliedit.litcoffee @@ -221,6 +221,8 @@ insert it into the array at end position. A la the draggon-dropping. $("#entryindex").val pos $("#entryname").val data.name $("#entryauthor").val data.author + $("#entryfiletpye").val data.filetype + $("#entryfiletype").children()[resolvefiletype data.filetype].selected = true $("#entryamiga").val data.amiga $("#entryamiga").children()[1].textContent = ansiorascii data.amiga $("#entryfont").val data.font @@ -249,6 +251,23 @@ Boolean / integer Helpers statustobool = (status) -> if status is 'Ascii' then true else false +Resolve filetype offset in array: + + resolvefiletype = (filetype) -> + options = { + "plain":0 + "ansi":1 + "xbin":2 + "ice":3 + "adf":4 + "avatar":5 + "bin":6 + "idf":7 + "pcboard":8 + "tundra":9 + } + options[filetype] + Resolve ansi or ascii status ansiorascii = (status) -> @@ -277,7 +296,6 @@ we actually _want_ that limitation in the output. x.push 0 x - Need a way to convert the array back to the color name. colortoname = (color) -> diff --git a/editor/sahlieditor.html b/editor/sahlieditor.html index 7185941..3f62c02 100644 --- a/editor/sahlieditor.html +++ b/editor/sahlieditor.html @@ -59,7 +59,7 @@
  • -