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">Z</span> Zoom full width</li>
<li><span class="key">Q</span> Best fit for images</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">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">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">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> <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", "file": "spaceflight.asc",
"name": "Spaceflight", "name": "Spaceflight",
"amiga": true, "amiga": true,
"filetype": "plain", "filetype": "plain",
"width": "80", "width": "80",
"author": "Urs", "author": "Urs",
"font": "pot-noodle", "font": "pot-noodle",
"color": [ "color": [
255, 255,
128, 128,
0, 0,
255 255
], ],
"bg": [ "bg": [
0, 0,
0, 0,
0, 0,
255 255
], ],
"line1": "Orange on Dark Grey", "line1": "Orange on Dark Grey",
"line2": "Test for plain files", "line2": "Test for plain files",
"text": "" "text": ""
}, },
{ {
"file": "az0!-revi510n.txt", "file": "az0!-revi510n.txt",
"name": "Revision", "name": "Revision",
"amiga": true, "amiga": true,
"filetype": "plain", "filetype": "plain",
"width": "80", "width": "80",
"author": "Azzarro/Madwizards", "author": "Azzarro/Madwizards",
"font": "mosoul",
"font": "Propaz", "color": [
"color": [
0, 0,
240, 240,
0, 0,
255 255
], ],
"bg": [ "bg": [
255, 255,
0, 0,
0, 0,
255 255
], ],
"line1": "Azzaro Returns", "line1": "Azzaro Returns",
"line2": "Revision ansi/ascii compo 2013", "line2": "Revision ansi/ascii compo 2013",
"text": "Color test as well as mOsOul test."
"text": "Color test as well as Microknight test."
}, },
{ {
"file": "dS!-JUFV.txt", "file": "dS!-JUFV.txt",

View file

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

View file

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