Fix: Font Picker now shows font chosen and saves font.

This commit is contained in:
Iam Naughton Phier 2015-03-27 18:10:58 +02:00
parent 16207fc2ae
commit f8134f41d2
3 changed files with 29 additions and 29 deletions

View file

@ -65,10 +65,16 @@ $(->
else else
stuff[1].textContent = 'Ascii' stuff[1].textContent = 'Ascii'
@.value = "1" @.value = "1"
$(".45box").css {width:'45%',display:'inline-block'} $(".45box").css {width:'40ex',display:'inline-block'}
$(".groupbox p").css {margin:"0 0 .25em 0"} $(".groupbox p").css {margin:"0 0 .25em 0"}
$(".colorbox").change -> $(".colorbox").change ->
sahlicolor() sahlicolor()
$("#entryfont").change ->
font = $("#entryfont").val()
if font == "ansifont"
font = "BlockZone"
$('pre').css 'font-family',font
$("#entryfilepick").change -> $("#entryfilepick").change ->
if @.files[0]? then $("#entryfile").val @.files[0].name if @.files[0]? then $("#entryfile").val @.files[0].name
@ -135,7 +141,6 @@ class Sahli
.click => .click =>
$('#sahlioutput').text dumpjson @data $('#sahlioutput').text dumpjson @data
$('#dumparea').show 100 $('#dumparea').show 100
console.log dumpjson @data
$('#listlist').button {icons: {primary:"ui-icon-folder-open"}} $('#listlist').button {icons: {primary:"ui-icon-folder-open"}}
.click -> .click ->
getfilelist() getfilelist()
@ -169,12 +174,6 @@ class Sahli
e = ui.item.index() e = ui.item.index()
@data.filedata = @.rearrangearray s,e,@data.filedata @data.filedata = @.rearrangearray s,e,@data.filedata
@buildlist @data @buildlist @data
console.log name.author,name.name,name.file for name in @data.filedata
console.log '---'
harry: (potter) ->
console.log "yer a lizzard, harry"
rearrangearray: (startpos,endpos,a) -> rearrangearray: (startpos,endpos,a) ->
moving = a[startpos] moving = a[startpos]
@ -215,6 +214,7 @@ class Sahli
entry.line1 = $("#entryline1").val() entry.line1 = $("#entryline1").val()
entry.line2 = $("#entryline2").val() entry.line2 = $("#entryline2").val()
entry.text = $("#entrytext").val() entry.text = $("#entrytext").val()
entry.font = $("#entryfont").val()
entry.file = $("#entryfile").val() entry.file = $("#entryfile").val()
entry.filetype = $("#entryfiletype").val() entry.filetype = $("#entryfiletype").val()
@buildlist @data @buildlist @data
@ -397,6 +397,7 @@ sahlicolor = ->
### ###
Function for loading the filelist from the specified directory on the Function for loading the filelist from the specified directory on the
server/filesystem. server/filesystem.
Needs to be made into an actual real thing.
### ###
getfilelist = -> getfilelist = ->

View file

@ -86,7 +86,7 @@ Silliness for checking that this works.
} }
}); });
$(".45box").css({ $(".45box").css({
width: '45%', width: '40ex',
display: 'inline-block' display: 'inline-block'
}); });
$(".groupbox p").css({ $(".groupbox p").css({
@ -95,6 +95,14 @@ Silliness for checking that this works.
$(".colorbox").change(function() { $(".colorbox").change(function() {
return sahlicolor(); return sahlicolor();
}); });
$("#entryfont").change(function() {
var font;
font = $("#entryfont").val();
if (font === "ansifont") {
font = "BlockZone";
}
return $('pre').css('font-family', font);
});
$("#entryfilepick").change(function() { $("#entryfilepick").change(function() {
if (this.files[0] != null) { if (this.files[0] != null) {
return $("#entryfile").val(this.files[0].name); return $("#entryfile").val(this.files[0].name);
@ -181,8 +189,7 @@ Silliness for checking that this works.
}).click((function(_this) { }).click((function(_this) {
return function() { return function() {
$('#sahlioutput').text(dumpjson(_this.data)); $('#sahlioutput').text(dumpjson(_this.data));
$('#dumparea').show(100); return $('#dumparea').show(100);
return console.log(dumpjson(_this.data));
}; };
})(this)); })(this));
$('#listlist').button({ $('#listlist').button({
@ -244,27 +251,17 @@ Silliness for checking that this works.
}, },
stop: (function(_this) { stop: (function(_this) {
return function(event, ui) { return function(event, ui) {
var a, e, name, s, _k, _len2, _ref2; var a, e, s;
a = 2; a = 2;
s = ui.item.data().startpos; s = ui.item.data().startpos;
e = ui.item.index(); e = ui.item.index();
_this.data.filedata = _this.rearrangearray(s, e, _this.data.filedata); _this.data.filedata = _this.rearrangearray(s, e, _this.data.filedata);
_this.buildlist(_this.data); return _this.buildlist(_this.data);
_ref2 = _this.data.filedata;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
name = _ref2[_k];
console.log(name.author, name.name, name.file);
}
return console.log('---');
}; };
})(this) })(this)
}); });
}; };
Sahli.prototype.harry = function(potter) {
return console.log("yer a lizzard, harry");
};
Sahli.prototype.rearrangearray = function(startpos, endpos, a) { Sahli.prototype.rearrangearray = function(startpos, endpos, a) {
var alen, moving, tarr; var alen, moving, tarr;
moving = a[startpos]; moving = a[startpos];
@ -315,6 +312,7 @@ Silliness for checking that this works.
entry.line1 = $("#entryline1").val(); entry.line1 = $("#entryline1").val();
entry.line2 = $("#entryline2").val(); entry.line2 = $("#entryline2").val();
entry.text = $("#entrytext").val(); entry.text = $("#entrytext").val();
entry.font = $("#entryfont").val();
entry.file = $("#entryfile").val(); entry.file = $("#entryfile").val();
entry.filetype = $("#entryfiletype").val(); entry.filetype = $("#entryfiletype").val();
return this.buildlist(this.data); return this.buildlist(this.data);
@ -569,6 +567,7 @@ Silliness for checking that this works.
/* /*
Function for loading the filelist from the specified directory on the Function for loading the filelist from the specified directory on the
server/filesystem. server/filesystem.
Needs to be made into an actual real thing.
*/ */
getfilelist = function() { getfilelist = function() {

View file

@ -83,12 +83,12 @@
<li> <li>
<label for="font">Font:</label> <label for="font">Font:</label>
<select id='entryfont' name="font"> <select id='entryfont' name="font">
<option value="propaz">Topaz 2.0</option> <option value="Topaz1200">Topaz1200</option>
<option value="topaz">Topaz 1.3</option> <option value="Topaz500">Topaz500</option>
<option value="mosoul">mOsOul</option> <option value="mOsOul">mOsOul</option>
<option value="microknight">Microknight</option> <option value="MicroKnight">Microknight</option>
<option value="pot-noodle">P0t-nOodle</option> <option value="P0t-nOodle">P0t-nOodle</option>
<option value="blockzone">BlockZone</option> <option value="BlockZone">BlockZone</option>
<option value="ansifont">Ansifont</option> <option value="ansifont">Ansifont</option>
</select> </select>
</li> </li>