Added generic picture support

This commit is contained in:
m0qui 2017-03-18 19:27:43 +01:00
parent ae90ebd06c
commit 4f884d9cac
4 changed files with 38 additions and 6 deletions

View file

@ -39,6 +39,8 @@ class @Sahli
@loadhugeansi picdata, inserthere
when 'tundra'
@loadhugeansi picdata, inserthere
when 'image'
@loadpicture picdata, inserthere
else
@loadplain picdata, inserthere
@ -78,6 +80,18 @@ class @Sahli
req.open 'GET', fname, true
req.send null
@loadpicture = (picdata, inserthere) ->
fname = @location + '/' + picdata.file
pdiv = $('<div>')
pdiv.addClass 'scrolly'
pdiv.width picdata.width
pdiv.css 'display', 'inline-block'
pimg = $('<img src="' + fname + '" width="100%"/>')
pdiv.append pimg
inserthere.after pdiv
$('body').scrollTop 0
@origwidth = picdata.width
@loadhugeansi = (picdata, inserthere) ->
fname = @location + '/' + picdata.file
pdiv = $('<div>')
@ -97,7 +111,7 @@ class @Sahli
@origwidth = canvwidth
@origheight = calcheight
pdiv.width canvwidth
), 30, 'bits': '8'
), 30, {'bits': '8', "font": picdata.font}
@loadavatar = (picdata, inserthere) ->
console.log 'avatar', picdata, inserthere
@ -237,7 +251,7 @@ class @Sahli
zoomee.width newwidth
$('canvas').width newwidth
else
if zoomee.width() != @origwidth
if ''+zoomee.width() != ''+@origwidth
zoomee.width @origwidth
$('canvas').width '100%'
else