fix: always start at top
- additional cleanup of some things.
This commit is contained in:
parent
736240d41c
commit
adf666baaf
2 changed files with 7 additions and 45 deletions
27
sahli.coffee
27
sahli.coffee
|
|
@ -64,36 +64,17 @@ class @Sahli
|
||||||
pdiv.prepend buf.clone()
|
pdiv.prepend buf.clone()
|
||||||
pdiv.append ptxt
|
pdiv.append ptxt
|
||||||
pdiv.append buf
|
pdiv.append buf
|
||||||
# this is going to be interesting when dealing with ansi files in UTF-8
|
|
||||||
# or SHIFT-JIS etc - is it needed now? no. it is not.
|
|
||||||
# req.overrideMimeType 'text/plain; charset=ISO-8859-1'
|
|
||||||
req.onreadystatechange = ->
|
req.onreadystatechange = ->
|
||||||
if req.readyState == req.DONE
|
if req.readyState == req.DONE
|
||||||
if req.status == 200 or req.status == 0
|
if req.status == 200 or req.status == 0
|
||||||
ptxt.text @responseText
|
ptxt.text @responseText
|
||||||
inserthere.after pdiv
|
inserthere.after pdiv
|
||||||
$('body').scrollTop(0)
|
$('body').scrollTop 0
|
||||||
else
|
else
|
||||||
@loaderror inserthere, fname, req.statusText, req.status
|
@loaderror inserthere, fname, req.statusText, req.status
|
||||||
req.open 'GET', fname, true
|
req.open 'GET', fname, true
|
||||||
req.send null
|
req.send null
|
||||||
|
|
||||||
@loadansi = (picdata, inserthere) ->
|
|
||||||
fname = @location + '/' + picdata.file
|
|
||||||
pdiv = $('<div>')
|
|
||||||
pdiv.addClass 'scrolly'
|
|
||||||
AnsiLove.render fname, ((canv, SAUCE) ->
|
|
||||||
pdiv.append canv
|
|
||||||
inserthere.after pdiv
|
|
||||||
@origwidth = canv.width
|
|
||||||
@origheight = canv.height
|
|
||||||
@SAUCE = SAUCE
|
|
||||||
),
|
|
||||||
'font': '80x25'
|
|
||||||
'bits': '8'
|
|
||||||
'columns': 160
|
|
||||||
'thumbnail': 0
|
|
||||||
|
|
||||||
@loadhugeansi = (picdata, inserthere) ->
|
@loadhugeansi = (picdata, inserthere) ->
|
||||||
fname = @location + '/' + picdata.file
|
fname = @location + '/' + picdata.file
|
||||||
pdiv = $('<div>')
|
pdiv = $('<div>')
|
||||||
|
|
@ -108,6 +89,7 @@ class @Sahli
|
||||||
calcheight = calcheight + canv.height
|
calcheight = calcheight + canv.height
|
||||||
canvwidth = canv.width
|
canvwidth = canv.width
|
||||||
inserthere.after pdiv
|
inserthere.after pdiv
|
||||||
|
$('body').scrollTop 0
|
||||||
@SAUCE = SAUCE
|
@SAUCE = SAUCE
|
||||||
@origwidth = canvwidth
|
@origwidth = canvwidth
|
||||||
@origheight = calcheight
|
@origheight = calcheight
|
||||||
|
|
@ -115,7 +97,7 @@ class @Sahli
|
||||||
), 30, 'bits': '8'
|
), 30, 'bits': '8'
|
||||||
|
|
||||||
@loadavatar = (picdata, inserthere) ->
|
@loadavatar = (picdata, inserthere) ->
|
||||||
alert 'avatar', picdata, inserthere
|
console.log 'avatar', picdata, inserthere
|
||||||
|
|
||||||
@requestsahlifile = (url) ->
|
@requestsahlifile = (url) ->
|
||||||
@loadkeys()
|
@loadkeys()
|
||||||
|
|
@ -159,8 +141,7 @@ class @Sahli
|
||||||
$('#panel').hide()
|
$('#panel').hide()
|
||||||
$('#outbox').show()
|
$('#outbox').show()
|
||||||
$('body').stop()
|
$('body').stop()
|
||||||
@loadinfopanel(i)
|
@loadinfopanel i
|
||||||
$('body').scrollTop(0)
|
|
||||||
|
|
||||||
|
|
||||||
@togglefullscreen = ->
|
@togglefullscreen = ->
|
||||||
|
|
|
||||||
25
sahli.js
25
sahli.js
|
|
@ -86,25 +86,6 @@ l__________/__________|___|______l__________j_____j
|
||||||
return req.send(null);
|
return req.send(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
Sahli.loadansi = function(picdata, inserthere) {
|
|
||||||
var fname, pdiv;
|
|
||||||
fname = this.location + '/' + picdata.file;
|
|
||||||
pdiv = $('<div>');
|
|
||||||
pdiv.addClass('scrolly');
|
|
||||||
return AnsiLove.render(fname, (function(canv, SAUCE) {
|
|
||||||
pdiv.append(canv);
|
|
||||||
inserthere.after(pdiv);
|
|
||||||
this.origwidth = canv.width;
|
|
||||||
this.origheight = canv.height;
|
|
||||||
return this.SAUCE = SAUCE;
|
|
||||||
}), {
|
|
||||||
'font': '80x25',
|
|
||||||
'bits': '8',
|
|
||||||
'columns': 160,
|
|
||||||
'thumbnail': 0
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Sahli.loadhugeansi = function(picdata, inserthere) {
|
Sahli.loadhugeansi = function(picdata, inserthere) {
|
||||||
var calcheight, canvwidth, fname, pdiv;
|
var calcheight, canvwidth, fname, pdiv;
|
||||||
fname = this.location + '/' + picdata.file;
|
fname = this.location + '/' + picdata.file;
|
||||||
|
|
@ -122,6 +103,7 @@ l__________/__________|___|______l__________j_____j
|
||||||
return canvwidth = canv.width;
|
return canvwidth = canv.width;
|
||||||
});
|
});
|
||||||
inserthere.after(pdiv);
|
inserthere.after(pdiv);
|
||||||
|
$('body').scrollTop(0);
|
||||||
_this.SAUCE = SAUCE;
|
_this.SAUCE = SAUCE;
|
||||||
_this.origwidth = canvwidth;
|
_this.origwidth = canvwidth;
|
||||||
_this.origheight = calcheight;
|
_this.origheight = calcheight;
|
||||||
|
|
@ -133,7 +115,7 @@ l__________/__________|___|______l__________j_____j
|
||||||
};
|
};
|
||||||
|
|
||||||
Sahli.loadavatar = function(picdata, inserthere) {
|
Sahli.loadavatar = function(picdata, inserthere) {
|
||||||
return alert('avatar', picdata, inserthere);
|
return console.log('avatar', picdata, inserthere);
|
||||||
};
|
};
|
||||||
|
|
||||||
Sahli.requestsahlifile = function(url) {
|
Sahli.requestsahlifile = function(url) {
|
||||||
|
|
@ -186,8 +168,7 @@ l__________/__________|___|______l__________j_____j
|
||||||
$('#panel').hide();
|
$('#panel').hide();
|
||||||
$('#outbox').show();
|
$('#outbox').show();
|
||||||
$('body').stop();
|
$('body').stop();
|
||||||
Sahli.loadinfopanel(i);
|
return Sahli.loadinfopanel(i);
|
||||||
return $('body').scrollTop(0);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Sahli.togglefullscreen = function() {
|
Sahli.togglefullscreen = function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue