Added generic picture support
This commit is contained in:
parent
ae90ebd06c
commit
4f884d9cac
4 changed files with 38 additions and 6 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
sahli = new Sahli;
|
sahli = new Sahli;
|
||||||
Sahli.requestsahlifile('list.sahli')
|
Sahli.requestsahlifile('2016uncoldschool.sahli')
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="sahli.css" type="text/css" media="screen" />
|
<link rel="stylesheet" href="sahli.css" type="text/css" media="screen" />
|
||||||
|
|
|
||||||
18
sahli.coffee
18
sahli.coffee
|
|
@ -39,6 +39,8 @@ class @Sahli
|
||||||
@loadhugeansi picdata, inserthere
|
@loadhugeansi picdata, inserthere
|
||||||
when 'tundra'
|
when 'tundra'
|
||||||
@loadhugeansi picdata, inserthere
|
@loadhugeansi picdata, inserthere
|
||||||
|
when 'image'
|
||||||
|
@loadpicture picdata, inserthere
|
||||||
else
|
else
|
||||||
@loadplain picdata, inserthere
|
@loadplain picdata, inserthere
|
||||||
|
|
||||||
|
|
@ -78,6 +80,18 @@ class @Sahli
|
||||||
req.open 'GET', fname, true
|
req.open 'GET', fname, true
|
||||||
req.send null
|
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) ->
|
@loadhugeansi = (picdata, inserthere) ->
|
||||||
fname = @location + '/' + picdata.file
|
fname = @location + '/' + picdata.file
|
||||||
pdiv = $('<div>')
|
pdiv = $('<div>')
|
||||||
|
|
@ -97,7 +111,7 @@ class @Sahli
|
||||||
@origwidth = canvwidth
|
@origwidth = canvwidth
|
||||||
@origheight = calcheight
|
@origheight = calcheight
|
||||||
pdiv.width canvwidth
|
pdiv.width canvwidth
|
||||||
), 30, 'bits': '8'
|
), 30, {'bits': '8', "font": picdata.font}
|
||||||
|
|
||||||
@loadavatar = (picdata, inserthere) ->
|
@loadavatar = (picdata, inserthere) ->
|
||||||
console.log 'avatar', picdata, inserthere
|
console.log 'avatar', picdata, inserthere
|
||||||
|
|
@ -237,7 +251,7 @@ class @Sahli
|
||||||
zoomee.width newwidth
|
zoomee.width newwidth
|
||||||
$('canvas').width newwidth
|
$('canvas').width newwidth
|
||||||
else
|
else
|
||||||
if zoomee.width() != @origwidth
|
if ''+zoomee.width() != ''+@origwidth
|
||||||
zoomee.width @origwidth
|
zoomee.width @origwidth
|
||||||
$('canvas').width '100%'
|
$('canvas').width '100%'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ body {
|
||||||
h6 {
|
h6 {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.help {
|
.help {
|
||||||
|
|
|
||||||
23
sahli.js
23
sahli.js
|
|
@ -1,4 +1,4 @@
|
||||||
// Generated by CoffeeScript 1.11.0
|
// Generated by CoffeeScript 1.9.3
|
||||||
|
|
||||||
/*
|
/*
|
||||||
.___________________________________, ___
|
.___________________________________, ___
|
||||||
|
|
@ -40,6 +40,8 @@ l__________/__________|___|______l__________j_____j
|
||||||
return this.loadhugeansi(picdata, inserthere);
|
return this.loadhugeansi(picdata, inserthere);
|
||||||
case 'tundra':
|
case 'tundra':
|
||||||
return this.loadhugeansi(picdata, inserthere);
|
return this.loadhugeansi(picdata, inserthere);
|
||||||
|
case 'image':
|
||||||
|
return this.loadpicture(picdata, inserthere);
|
||||||
default:
|
default:
|
||||||
return this.loadplain(picdata, inserthere);
|
return this.loadplain(picdata, inserthere);
|
||||||
}
|
}
|
||||||
|
|
@ -87,6 +89,20 @@ l__________/__________|___|______l__________j_____j
|
||||||
return req.send(null);
|
return req.send(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Sahli.loadpicture = function(picdata, inserthere) {
|
||||||
|
var fname, pdiv, pimg;
|
||||||
|
fname = this.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);
|
||||||
|
return this.origwidth = picdata.width;
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
||||||
|
|
@ -111,7 +127,8 @@ l__________/__________|___|______l__________j_____j
|
||||||
return pdiv.width(canvwidth);
|
return pdiv.width(canvwidth);
|
||||||
};
|
};
|
||||||
})(this)), 30, {
|
})(this)), 30, {
|
||||||
'bits': '8'
|
'bits': '8',
|
||||||
|
"font": picdata.font
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -280,7 +297,7 @@ l__________/__________|___|______l__________j_____j
|
||||||
zoomee.width(newwidth);
|
zoomee.width(newwidth);
|
||||||
return $('canvas').width(newwidth);
|
return $('canvas').width(newwidth);
|
||||||
} else {
|
} else {
|
||||||
if (zoomee.width() !== this.origwidth) {
|
if ('' + zoomee.width() !== '' + this.origwidth) {
|
||||||
zoomee.width(this.origwidth);
|
zoomee.width(this.origwidth);
|
||||||
return $('canvas').width('100%');
|
return $('canvas').width('100%');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue