Bugfix: not saving filetype / always 'plain'

- changed to switch statement for the routines
This commit is contained in:
Iam Naughton Phier 2014-08-08 00:22:08 +03:00
parent d0f5a09f45
commit 402df015a4
3 changed files with 35 additions and 44 deletions

View file

@ -84,20 +84,6 @@
Sahli = (function() { Sahli = (function() {
function Sahli() { function Sahli() {
this.emptyfiledef = new emptyfiledef; this.emptyfiledef = new emptyfiledef;
this.bob = {
"file": "",
"name": "",
"amiga": true,
"filetype": 'plain',
"width": "",
"author": "",
"font": "Propaz",
"color": [0, 0, 0, 0],
"bg": [0, 0, 0, 0],
"line1": "",
"line2": "",
"text": ""
};
this.emptyslidesdef = { this.emptyslidesdef = {
"background": "", "background": "",
"template": "", "template": "",
@ -264,6 +250,7 @@
entry.line2 = $("#entryline2").val(); entry.line2 = $("#entryline2").val();
entry.text = $("#entrytext").val(); entry.text = $("#entrytext").val();
entry.file = $("#entryfile").val(); entry.file = $("#entryfile").val();
entry.filetype = $("#entryfiletype").val();
return this.buildlist(this.data); return this.buildlist(this.data);
}; };

View file

@ -104,20 +104,6 @@ a html template, and a css file.
class Sahli class Sahli
constructor: -> constructor: ->
@emptyfiledef = new emptyfiledef @emptyfiledef = new emptyfiledef
@bob = {
"file": "",
"name": "",
"amiga": true,
"filetype": 'plain',
"width": "",
"author": "",
"font": "Propaz",
"color": [ 0,0,0,0 ],
"bg": [ 0,0,0,0 ],
"line1": "",
"line2": "",
"text": ""
}
@emptyslidesdef = { @emptyslidesdef = {
"background": "", "background": "",
"template": "", "template": "",
@ -233,6 +219,7 @@ insert it into the array at end position. A la the draggon-dropping.
entry.line2 = $("#entryline2").val() entry.line2 = $("#entryline2").val()
entry.text = $("#entrytext").val() entry.text = $("#entrytext").val()
entry.file = $("#entryfile").val() entry.file = $("#entryfile").val()
entry.filetype = $("#entryfiletype").val()
@buildlist @data @buildlist @data
editline: (data,pos) -> editline: (data,pos) ->

View file

@ -34,24 +34,41 @@ var Sahli = function () {
this.nonfsheight = document.height - 40; this.nonfsheight = document.height - 40;
this.loadpic = function (picdata, inserthere) { this.loadpic = function (picdata, inserthere) {
var jumptable = { switch (picdata.filetype) {
'plain':this.loadplain(picdata,inserthere), case 'plain':
'xbin':this.loadxbin(), this.loadplain(picdata, inserthere);
'ice':this.loadice(), break;
'avatar':this.loadavatar(), case 'ansi':
'pcboard':this.loadpcboard(), this.loadansi(picdata, inserthere);
'ansi':this.loadansi(), break;
'idf':this.loadidf(), case 'xbin':
'bin':this.loadbin(), this.loadxbin(picdata, inserthere);
'adf':this.loadadf(), break;
'tundra':this.loadtundra() case 'ice':
} this.loadice(picdata, inserthere);
console.log('here'); break;
jumptable[picdata.filetype]; case 'avatar':
this.loadavatar(picdata, inserthere);
break;
case 'pcboard':
this.loadpcboard(picdata, inserthere);
break;
case 'idf':
this.loadidf(picdata, inserthere);
break;
case 'adf':
this.loadadf(picdata, inserthere);
break;
case 'tundra':
this.loadtundra(picdata, inserthere);
break;
default:
this.loadplain(picdata, inserthere);
} }
};
this.loadplain = function(picdata, inserthere) { this.loadplain = function (picdata, inserthere) {
ref = this; var ref = this;
var pdiv = $('<div>'); var pdiv = $('<div>');
var canv = document.createElement('canvas'); var canv = document.createElement('canvas');
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();