Added feature to increase/decrease font size in Amiga/plain mode

This commit is contained in:
m0qui 2018-03-26 21:54:03 +02:00
parent 8f01863d39
commit 5e05d0fbb8
4 changed files with 30 additions and 55 deletions

View file

@ -49,6 +49,7 @@
<li><span class="key">Z</span> Zoom full width</li>
<li><span class="key">Q</span> Best fit for images</li>
<li><span class="key">E</span><span class="key">R</span> Zoom in steps larger/smaller</li>
<li><span class="key">8</span><span class="key">9</span> Incease/decrease font size by 2 (Amiga/plain mode)</li>
<li><span class="key">C</span> "panel" view toggle</li>
<li><span class="key">Up</span><span class="key">Down</span><span class="key">Pageup</span><span class="key">Pagedown</span> Move about by line/page</li>
<li><span class="key">Home</span><span class="key">End</span> Move to top/bottom (no zoom reset)</li>

View file

@ -67,97 +67,51 @@
{
"file": "spaceflight.asc",
"name": "Spaceflight",
"amiga": true,
"filetype": "plain",
"width": "80",
"author": "Urs",
"font": "pot-noodle",
"color": [
255,
128,
0,
255
],
"bg": [
0,
0,
0,
255
],
"line1": "Orange on Dark Grey",
"line2": "Test for plain files",
"text": ""
},
{
"file": "az0!-revi510n.txt",
"name": "Revision",
"amiga": true,
"filetype": "plain",
"width": "80",
"author": "Azzarro/Madwizards",
"font": "Propaz",
"color": [
"font": "mosoul",
"color": [
0,
240,
0,
255
],
"bg": [
255,
0,
0,
255
],
"line1": "Azzaro Returns",
"line2": "Revision ansi/ascii compo 2013",
"text": "Color test as well as Microknight test."
"text": "Color test as well as mOsOul test."
},
{
"file": "dS!-JUFV.txt",

View file

@ -52,6 +52,7 @@ class @Sahli
buf = $('<span>')
buf.css {'margin':'0 auto'}
ptxt = $('<pre>')
ptxt.addClass 'plaintext'
color = @calccolor(picdata.color)
bgcolor = @calccolor(picdata.bg)
pdiv.addClass 'scrolly'
@ -61,9 +62,9 @@ class @Sahli
'background-color': bgcolor
'margin': 'auto'
'display': 'inline-block'
ptxt.width picdata.width * 8
@origwidth = ptxt.width
pdiv.width ptxt.width
#ptxt.width picdata.width * 8
#@origwidth = ptxt.width
#pdiv.width ptxt.width
pdiv.prepend buf.clone()
pdiv.append ptxt
pdiv.append buf
@ -81,6 +82,10 @@ class @Sahli
req.open 'GET', fname, true
req.send null
@increaseFont = (node, increaseBy=5) ->
current_size = parseInt($(node).css("font-size"));
$(node).css("font-size", current_size + increaseBy);
@loadpicture = (picdata, inserthere) ->
fname = @location + '/' + picdata.file
pdiv = $('<div>')
@ -407,6 +412,10 @@ class @Sahli
@scroll_speed = 4
when @keycode '5'
@changespeed 5
when @keycode '8'
@increaseFont($('pre'), -2)
when @keycode '9'
@increaseFont($('pre'), 2)
when 40 # down
@moveline 1
when 38 # up

View file

@ -59,6 +59,7 @@ l__________/__________|___|______l__________j_____j
'margin': '0 auto'
});
ptxt = $('<pre>');
ptxt.addClass('plaintext');
color = this.calccolor(picdata.color);
bgcolor = this.calccolor(picdata.bg);
pdiv.addClass('scrolly');
@ -69,9 +70,6 @@ l__________/__________|___|______l__________j_____j
'margin': 'auto',
'display': 'inline-block'
});
ptxt.width(picdata.width * 8);
this.origwidth = ptxt.width;
pdiv.width(ptxt.width);
pdiv.prepend(buf.clone());
pdiv.append(ptxt);
pdiv.append(buf);
@ -91,6 +89,15 @@ l__________/__________|___|______l__________j_____j
return req.send(null);
};
Sahli.increaseFont = function(node, increaseBy) {
var current_size;
if (increaseBy == null) {
increaseBy = 5;
}
current_size = parseInt($(node).css("font-size"));
return $(node).css("font-size", current_size + increaseBy);
};
Sahli.loadpicture = function(picdata, inserthere) {
var fname, pdiv, pimg;
fname = this.location + '/' + picdata.file;
@ -476,6 +483,10 @@ l__________/__________|___|______l__________j_____j
return _this.scroll_speed = 4;
case _this.keycode('5'):
return _this.changespeed(5);
case _this.keycode('8'):
return _this.increaseFont($('pre'), -2);
case _this.keycode('9'):
return _this.increaseFont($('pre'), 2);
case 40:
return _this.moveline(1);
case 38: