change the filetype when loading to appropriate value
This commit is contained in:
parent
d1e2b9d1bf
commit
bb8a665aa6
3 changed files with 40 additions and 3 deletions
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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) ->
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<label for='filetype'>File Type:</label>
|
||||
<select>
|
||||
<select name='filetype' id='entryfiletype'>
|
||||
<option value="plain">plain</option>
|
||||
<option value="ansi">ansi</option>
|
||||
<option value="xbin">xbin</option>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue