Merge pull request #3 from lastebil/overhaul

all noted todo items complete except editor parts, ready for remote test by others
This commit is contained in:
Per Persson 2015-03-25 20:54:59 +02:00
commit 82489faae9
9 changed files with 1311 additions and 141 deletions

View file

@ -28,3 +28,15 @@ x 2015-02-22 Fix Amiga mode rendering via sixteencolors lib @16colors
x 2015-02-22 check below items for neccesity x 2015-02-22 check below items for neccesity
x 2015-02-22 load to array/picture, render from picture @16colors x 2015-02-22 load to array/picture, render from picture @16colors
x 2015-02-22 speed up rendering more? @16colors x 2015-02-22 speed up rendering more? @16colors
x 2015-03-25 BIN @OTHER
x 2015-03-25 IDF @OTHER
x 2015-03-25 Tundra @OTHER
x 2015-03-25 PCBOARD @OTHER
x 2015-03-25 Avatar @OTHER
x 2015-03-25 2015-02-22 ADF @OTHER
x 2015-03-25 XBIN @OTHER
x 2015-03-25 remove the SAUCE lines at bottom, return ANSI object for render @SAUCE
x 2015-03-25 help on top of panel mode (always top)
x 2015-03-25 info page
x 2015-03-25 center panel mode vertically
x 2015-03-25 center ascii if smaller than 1 page (ansi too?)

View file

@ -40,8 +40,10 @@
<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>
<li><span class="key">I</span> SAUCE or Partymeister info</li>
<li><span class="key">V</span> Center Small Ascii Vertically</li>
<li><span class="key">H</span> This help (: <span class="key">Esc</span> Cancel fullscreen</li> <li><span class="key">H</span> This help (: <span class="key">Esc</span> Cancel fullscreen</li>
<li class='nodot'><b>Tab also works for "info" but browsers hate it, so use 'U'</b></li> <li class='nodot'><b>Tab also works for "info" but browsers hate it, so use 'I'</b></li>
</ul> </ul>
</div> </div>
</div> </div>

File diff suppressed because one or more lines are too long

View file

@ -1,202 +1,499 @@
{ {
"location": "testshow", "location": "testshow",
"slides": { "slides": {
"background": "", "background": "",
"template": "", "template": "",
"css": "" "css": ""
}, },
"filedata": [ "filedata": [
{ {
"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",
"name": "Revision",
"amiga": true,
"filetype": "plain",
"width": "80",
"author": "Azzarro/Madwizards",
"font": "Propaz",
"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."
},
{
"file": "Glitch_8bit_ANSi_Compo_Entry_by_Luciano_Ayres.ans",
"name": "Glitch 8-bit",
"amiga": false,
"filetype": "ansi",
"width": "80",
"author": "Luciano Ayres",
"font": "Propaz",
"color": [
255,
255,
255,
255
],
"bg": [
0,
0,
0,
255
],
"line1": "NVscene 2015",
"line2": "Blocktronics",
"text": "f*n brilliant"
},
{
"file": "h7-supergroupies.ans", "file": "h7-supergroupies.ans",
"name": "SuperGroupies", "name": "SuperGroupies",
"amiga": false, "amiga": false,
"filetype": "ansi", "filetype": "ansi",
"width": "80", "width": "80",
"author": "H7", "author": "H7",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
154, 154,
254, 254,
46, 46,
255 255
], ],
"bg": [ "bg": [
11, 11,
11, 11,
59, 59,
255 255
], ],
"line1": "H7", "line1": "H7",
"line2": "Ansi", "line2": "Ansi",
"text": "Test file #1" "text": "Test file #1"
}, },
{ {
"file": "Blocktronics-WTF4_Megajoint.ans", "file": "Blocktronics-WTF4_Megajoint.ans",
"name": "WTF4", "name": "WTF4",
"amiga": false, "amiga": false,
"filetype": "ansi", "filetype": "ansi",
"width": "80", "width": "80",
"author": "Blocktronics", "author": "Blocktronics",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
0, 0,
46, 46,
247, 247,
255 255
], ],
"bg": [ "bg": [
160, 160,
160, 160,
224, 224,
255 255
], ],
"line1": "", "line1": "",
"line2": "", "line2": "",
"text": "" "text": ""
}, },
{ {
"file": "51_DRGN.XB", "file": "51_DRGN.XB",
"name": "Dragon", "name": "Dragon",
"amiga": false, "amiga": false,
"filetype": "xbin", "filetype": "xbin",
"width": "80", "width": "80",
"author": "Someone", "author": "Someone",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
255, 255,
128, 128,
0, 0,
255 255
], ],
"bg": [ "bg": [
46, 46,
254, 254,
247, 247,
255 255
], ],
"line1": "Test #2", "line1": "Test #2",
"line2": "Test #2", "line2": "Test #2",
"text": "" "text": ""
}, },
{ {
"file": "ARTX-LGO.ADF", "file": "ARTX-LGO.ADF",
"name": "ADF test", "name": "ADF test",
"amiga": false, "amiga": false,
"filetype": "adf", "filetype": "adf",
"width": "80", "width": "80",
"author": "", "author": "",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
255, 255,
255, 255,
255, 255,
255 255
], ],
"bg": [ "bg": [
0, 0,
0, 0,
0, 0,
255 255
], ],
"line1": "", "line1": "",
"line2": "", "line2": "",
"text": "" "text": ""
}, },
{ {
"file": "MD-XMAS.IDF", "file": "MD-XMAS.IDF",
"name": "IDF test", "name": "IDF test",
"amiga": false, "amiga": false,
"filetype": "idf", "filetype": "idf",
"width": "80", "width": "80",
"author": "", "author": "",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
255, 255,
255, 255,
255, 255,
255 255
], ],
"bg": [ "bg": [
0, 0,
0, 0,
0, 0,
255 255
], ],
"line1": "", "line1": "",
"line2": "", "line2": "",
"text": "" "text": ""
}, },
{ {
"file": "US-SADIS.BIN", "file": "US-SADIS.BIN",
"name": "BIN test", "name": "BIN test",
"amiga": false, "amiga": false,
"filetype": "bin", "filetype": "bin",
"width": "160", "width": "160",
"author": "", "author": "",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
255, 255,
255, 255,
255, 255,
255 255
], ],
"bg": [ "bg": [
0, 0,
0, 0,
0, 0,
255 255
], ],
"line1": "", "line1": "",
"line2": "", "line2": "",
"text": "" "text": ""
}, },
{ {
"file": "zv_iniq.tnd", "file": "zv_iniq.tnd",
"name": "Tundra test", "name": "Tundra test",
"amiga": false, "amiga": false,
"filetype": "tundra", "filetype": "tundra",
"width": "80", "width": "80",
"author": "", "author": "",
"font": "Propaz", "font": "Propaz",
"color": [ "color": [
255, 255,
255, 255,
255, 255,
255 255
], ],
"bg": [ "bg": [
0, 0,
0, 0,
0, 0,
255 255
], ],
"line1": "", "line1": "",
"line2": "", "line2": "",
"text": "" "text": ""
} }
] ]
} }

View file

@ -64,36 +64,20 @@ 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 # this is still needed for some Amiga stuff done on Amiga.
# or SHIFT-JIS etc - is it needed now? # probably should allow other overrides for UTF-8 and so on.
req.overrideMimeType 'text/plain; charset=ISO-8859-1' 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 +92,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 +100,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()
@ -129,9 +114,19 @@ class @Sahli
@filedata = json.filedata @filedata = json.filedata
@slides = json.slides @slides = json.slides
@location = json.location @location = json.location
alert "SAHLI READY TO GO\n#{@filedata.length} Entries" alert "SAHLI READY TO GO\n#{@filedata.length} Entries"
@loadinfopanel = (index) ->
data = @filedata[index]
$('.infobox h1').text data.name
$('.infobox h2').text data.author
$('h3.infobox')[0].textContent = data.line1
$('h3.infobox')[1].textContent = data.line2
$('p.bigtext').text data.text
$('.infobox span')[0].textContent = data.filename
$('.infobox span')[1].textContent = data.width
$('.infobox span')[2].textContent = data.font
@nextpic = => @nextpic = =>
viewbox = $('div#sahliviewer') viewbox = $('div#sahliviewer')
viewbox.children().remove() viewbox.children().remove()
@ -149,8 +144,7 @@ class @Sahli
$('#panel').hide() $('#panel').hide()
$('#outbox').show() $('#outbox').show()
$('body').stop() $('body').stop()
$('body').scrollTop(0) @loadinfopanel i
@togglefullscreen = -> @togglefullscreen = ->
docElm = document.documentElement docElm = document.documentElement
@ -210,6 +204,13 @@ class @Sahli
@scroll_direction = - @scroll_direction @scroll_direction = - @scroll_direction
@setscroll() @setscroll()
# chromium wasn't working with up/down/pageup/pagedown, firefox was. This makes
# both work the same way.
@moveline = (direction) ->
curpos = $('body').scrollTop()
$('body').scrollTop(curpos + (16*direction))
@changescrolldirection = (direction) -> @changescrolldirection = (direction) ->
@scroll_direction = direction @scroll_direction = direction
$('body').stop() $('body').stop()
@ -218,7 +219,7 @@ class @Sahli
# - save width upon draw # - save width upon draw
# - toggle zoom out to full width / normal # - toggle zoom out to full width / normal
# - with a number, change width by that much # - with a number, change width by that much
# if scrolling, where are we in the doc? zoom to THAT area. # if scrolling, where are we in the doc? zoom to THAT area. - not implemented
@zoom = (amt) -> @zoom = (amt) ->
zoomee = $('div.scrolly') zoomee = $('div.scrolly')
if amt? if amt?
@ -226,72 +227,71 @@ class @Sahli
newwidth = @origwidth newwidth = @origwidth
else else
newwidth = zoomee.width() + amt newwidth = zoomee.width() + amt
console.log "#{zoomee.width()} #{newwidth}"
zoomee.width newwidth zoomee.width newwidth
$('canvas').width newwidth $('canvas').width newwidth
else else
if zoomee.width() != @origwidth if zoomee.width() != @origwidth
zoomee.width @origwidthg zoomee.width @origwidth
$('canvas').width '100%' $('canvas').width '100%'
else else
zoomee.width '100%' zoomee.width '100%'
$('canvas').width '100%' $('canvas').width '100%'
# calculate # strips - how many times does window height go into full height # create a panel of 'strips' so as to show a very long vertical piece on one
# and then move the canvases into it. - done # big 'plate'
# outbox toggled last to avoid losing width. (prolly need to fix.)
@panelmode = -> @panelmode = ->
$('#panel').toggle() $('#panel').toggle()
canvs = $('canvas') canvs = $('canvas')
if $('.scrolly').width() == @origwidth $('.scrolly').width @origwidth
$('.scrolly').width '100%' if $('#panel').css('display') != 'none'
$('#panel').empty() $('#panel').empty()
ww = window.innerWidth ww = window.innerWidth
wh = window.innerHeight wh = window.innerHeight
numpanels = canvs.length numpanels = canvs.length
fullpicheight = 0 screenratio = ww/wh
fullpicheight = (fullpicheight + i.height) for i in canvs
stripe_width = ww/Math.ceil(fullpicheight/ww) panelratio = canvs[0].height/canvs[0].width
num_strips = Math.sqrt (ww/stripe_width)*(fullpicheight/wh)
numcols = Math.floor num_strips-1 x = Math.sqrt numpanels/screenratio
numcols = Math.round(screenratio*x)
picdpercol = Math.round(numpanels/numcols)
scaling_factor = num_strips * (wh / fullpicheight) newwidth = ww/numcols
# newheight = canvs[0].height * scaling_factor
# $(canvs[0]).height newheight
newwidth = scaling_factor * canvs.height()
canvs.width newwidth canvs.width newwidth
newheight = $(canvs[0]).height()
colwidth = ww/numcols newheight = canvs.height()
panelsperslot = Math.floor wh/newheight
panelslotheight = panelsperslot * newheight
outer = $('<div>') outer = $('<div>')
outer.append @createpanel(i,colwidth - 6) for i in [1..numcols] console.log numcols
outer.addClass 'nosb' outer.addClass 'nosb'
$('#panel').append outer $('#panel').append outer
$('#outbox').toggle() $('#outbox').toggle()
level = 0 level = 0
drawcol = 1 drawcol = 1
ct = 0
outer.append @createpanel(1,newwidth - 6)
for pic in canvs for pic in canvs
$("#column#{drawcol}").append pic $("#column#{drawcol}").append pic
level = level + newheight level += 1
if level+(newheight/2) > wh ct += 1
if level == panelsperslot
level = 0 level = 0
drawcol = drawcol + 1 drawcol = drawcol + 1
if ct < numpanels
outer.append @createpanel(drawcol,newwidth - 6)
else else
$('.scrolly').width @origwidth
$('#outbox').show() $('#outbox').show()
$('.scrolly').append pic for pic in canvs $('.scrolly').append pic for pic in canvs
canvs.width @origwidth canvs.width @origwidth
$('body').scrollTop 0 $('body').scrollTop 0
@createpanel = (i,amt) -> @createpanel = (i,amt) ->
dcol = $("<div id='column#{i}'>#{i}</div>") dcol = $("<div id='column#{i}' class='panelcolumn'>#{i}</div>")
dcol.addClass 'panelcolumn'
dcol.width amt dcol.width amt
@loadkeys = -> @loadkeys = ->
@ -322,7 +322,11 @@ class @Sahli
when @keycode 'x' when @keycode 'x'
@changescrolldirection 1 @changescrolldirection 1
when @keycode 'c' when @keycode 'c'
@panelmode() @panelmode(1)
when @keycode 'i'
$('div.infobox').toggle()
when @keycode 'v'
$('h6').height( (window.innerHeight - $('.scrolly').height()) / 2 )
when @keycode '1' when @keycode '1'
@changespeed 1 @changespeed 1
when @keycode '2' when @keycode '2'
@ -336,6 +340,14 @@ class @Sahli
@scroll_speed = 4 @scroll_speed = 4
when @keycode '5' when @keycode '5'
@changespeed 5 @changespeed 5
when 40 # down
@moveline 1
when 38 # up
@moveline -1
when 34 # pagedown
@moveline 40
when 33 # pageup
@moveline -40
when @keycode 'h' when @keycode 'h'
$('.help').css {'left':'33%'} $('.help').css {'left':'33%'}
$('.help').toggle 'fast' $('.help').toggle 'fast'

View file

@ -1,3 +1,7 @@
/*
Sahli css
*/
body { body {
background-color: black; background-color: black;
margin: 0; margin: 0;
@ -28,17 +32,8 @@ body {
} }
h6 { h6 {
position: fixed; color: transparent;
top: 1ex; background-color: transparent;
left: 1ex;
border: 1px green ridge;
padding: .125em 1em;
color: black;
background-color: green;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
display: none;
} }
.help { .help {
@ -79,7 +74,7 @@ h1.help {
padding: .15ex; padding: .15ex;
} }
ul.keylist li.nodot { ul.keylist nodot {
list-style: none; list-style: none;
padding-left: 2em; padding-left: 2em;
} }
@ -96,12 +91,12 @@ ul.keylist li.nodot {
div.infobox { div.infobox {
font-family: mosoul,topaz1200,microknight, Consolas, monospace; font-family: mosoul,topaz1200,microknight, Consolas, monospace;
position: absolute; position: fixed;
top: 1ex; top: 1ex;
left: 1ex; left: 1ex;
-webkit-border-radius: 42px; -webkit-border-radius: 1ex;
-moz-border-radius: 42px; -moz-border-radius: 1ex;
border-radius: 42px; border-radius: 1ex;
padding: 2ex; padding: 2ex;
margin: 3em; margin: 3em;
background-color: aliceblue; background-color: aliceblue;
@ -127,40 +122,43 @@ p.infobox {
margin: .25ex; margin: .25ex;
} }
.ty50 {
transform: translateY(-50%);
}
.bigtext { .bigtext {
background-color: lightsteelblue; background-color: lightsteelblue;
border: 1px outset steelblue; border: 1px outset steelblue;
margin: .25ex; margin: .25ex;
-webkit-border-radius: 15px; padding: .5ex;
-moz-border-radius: 15px; -webkit-border-radius: 0.5em;
border-radius: 15px; -moz-border-radius: 0.5em;
border-radius: 0.5em;
width: 30ex; width: 30ex;
} }
#panel { #panel {
width: 100%; width: 100%;
background: #0a0a0f;
height: 100%; height: 100%;
border: 0; border: 0;
font-family: microknight; font-family: microknight;
position: absolute; position: fixed;
left: 0; left: 0;
top: 0; top: 50%;
padding: 0; padding: 0;
margin: 0; margin: 0;
text-align: center; text-align: center;
} }
.panelcolumn { .panelcolumn {
height: 100%; color: transparent;
color: #00f080;
width: 2em; width: 2em;
background: #082020;
display: inline-table; display: inline-table;
} }
.nosb { .nosb {
overflow: hidden; overflow: hidden;
transform: translateY(-50%);
} }
@font-face { @font-face {

117
sahli.js
View file

@ -87,25 +87,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;
@ -123,6 +104,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;
@ -134,7 +116,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) {
@ -155,6 +137,19 @@ l__________/__________|___|______l__________j_____j
})(this)); })(this));
}; };
Sahli.loadinfopanel = function(index) {
var data;
data = this.filedata[index];
$('.infobox h1').text(data.name);
$('.infobox h2').text(data.author);
$('h3.infobox')[0].textContent = data.line1;
$('h3.infobox')[1].textContent = data.line2;
$('p.bigtext').text(data.text);
$('.infobox span')[0].textContent = data.filename;
$('.infobox span')[1].textContent = data.width;
return $('.infobox span')[2].textContent = data.font;
};
Sahli.nextpic = function() { Sahli.nextpic = function() {
var filedata, i, viewbox; var filedata, i, viewbox;
viewbox = $('div#sahliviewer'); viewbox = $('div#sahliviewer');
@ -174,7 +169,7 @@ l__________/__________|___|______l__________j_____j
$('#panel').hide(); $('#panel').hide();
$('#outbox').show(); $('#outbox').show();
$('body').stop(); $('body').stop();
return $('body').scrollTop(0); return Sahli.loadinfopanel(i);
}; };
Sahli.togglefullscreen = function() { Sahli.togglefullscreen = function() {
@ -251,6 +246,12 @@ l__________/__________|___|______l__________j_____j
return this.setscroll(); return this.setscroll();
}; };
Sahli.moveline = function(direction) {
var curpos;
curpos = $('body').scrollTop();
return $('body').scrollTop(curpos + (16 * direction));
};
Sahli.changescrolldirection = function(direction) { Sahli.changescrolldirection = function(direction) {
this.scroll_direction = direction; this.scroll_direction = direction;
$('body').stop(); $('body').stop();
@ -266,12 +267,11 @@ l__________/__________|___|______l__________j_____j
} else { } else {
newwidth = zoomee.width() + amt; newwidth = zoomee.width() + amt;
} }
console.log((zoomee.width()) + " " + newwidth);
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.origwidthg); zoomee.width(this.origwidth);
return $('canvas').width('100%'); return $('canvas').width('100%');
} else { } else {
zoomee.width('100%'); zoomee.width('100%');
@ -281,55 +281,57 @@ l__________/__________|___|______l__________j_____j
}; };
Sahli.panelmode = function() { Sahli.panelmode = function() {
var canvs, colwidth, drawcol, fullpicheight, i, level, newheight, newwidth, num_strips, numcols, numpanels, outer, pic, scaling_factor, stripe_width, wh, ww, _i, _j, _k, _l, _len, _len1, _len2, _results; var canvs, ct, drawcol, level, newheight, newwidth, numcols, numpanels, outer, panelratio, panelslotheight, panelsperslot, pic, picdpercol, screenratio, wh, ww, x, _i, _j, _len, _len1, _results;
$('#panel').toggle(); $('#panel').toggle();
canvs = $('canvas'); canvs = $('canvas');
if ($('.scrolly').width() === this.origwidth) { $('.scrolly').width(this.origwidth);
$('.scrolly').width('100%'); if ($('#panel').css('display') !== 'none') {
$('#panel').empty(); $('#panel').empty();
ww = window.innerWidth; ww = window.innerWidth;
wh = window.innerHeight; wh = window.innerHeight;
numpanels = canvs.length; numpanels = canvs.length;
fullpicheight = 0; screenratio = ww / wh;
for (_i = 0, _len = canvs.length; _i < _len; _i++) { panelratio = canvs[0].height / canvs[0].width;
i = canvs[_i]; x = Math.sqrt(numpanels / screenratio);
fullpicheight = fullpicheight + i.height; numcols = Math.round(screenratio * x);
} picdpercol = Math.round(numpanels / numcols);
stripe_width = ww / Math.ceil(fullpicheight / ww); newwidth = ww / numcols;
num_strips = Math.sqrt((ww / stripe_width) * (fullpicheight / wh));
numcols = Math.floor(num_strips - 1);
scaling_factor = num_strips * (wh / fullpicheight);
newwidth = scaling_factor * canvs.height();
canvs.width(newwidth); canvs.width(newwidth);
newheight = $(canvs[0]).height(); newheight = canvs.height();
colwidth = ww / numcols; panelsperslot = Math.floor(wh / newheight);
panelslotheight = panelsperslot * newheight;
outer = $('<div>'); outer = $('<div>');
for (i = _j = 1; 1 <= numcols ? _j <= numcols : _j >= numcols; i = 1 <= numcols ? ++_j : --_j) { console.log(numcols);
outer.append(this.createpanel(i, colwidth - 6));
}
outer.addClass('nosb'); outer.addClass('nosb');
$('#panel').append(outer); $('#panel').append(outer);
$('#outbox').toggle(); $('#outbox').toggle();
level = 0; level = 0;
drawcol = 1; drawcol = 1;
ct = 0;
outer.append(this.createpanel(1, newwidth - 6));
_results = []; _results = [];
for (_k = 0, _len1 = canvs.length; _k < _len1; _k++) { for (_i = 0, _len = canvs.length; _i < _len; _i++) {
pic = canvs[_k]; pic = canvs[_i];
$("#column" + drawcol).append(pic); $("#column" + drawcol).append(pic);
level = level + newheight; level += 1;
if (level + (newheight / 2) > wh) { ct += 1;
if (level === panelsperslot) {
level = 0; level = 0;
_results.push(drawcol = drawcol + 1); drawcol = drawcol + 1;
if (ct < numpanels) {
_results.push(outer.append(this.createpanel(drawcol, newwidth - 6)));
} else {
_results.push(void 0);
}
} else { } else {
_results.push(void 0); _results.push(void 0);
} }
} }
return _results; return _results;
} else { } else {
$('.scrolly').width(this.origwidth);
$('#outbox').show(); $('#outbox').show();
for (_l = 0, _len2 = canvs.length; _l < _len2; _l++) { for (_j = 0, _len1 = canvs.length; _j < _len1; _j++) {
pic = canvs[_l]; pic = canvs[_j];
$('.scrolly').append(pic); $('.scrolly').append(pic);
} }
canvs.width(this.origwidth); canvs.width(this.origwidth);
@ -339,8 +341,7 @@ l__________/__________|___|______l__________j_____j
Sahli.createpanel = function(i, amt) { Sahli.createpanel = function(i, amt) {
var dcol; var dcol;
dcol = $("<div id='column" + i + "'>" + i + "</div>"); dcol = $("<div id='column" + i + "' class='panelcolumn'>" + i + "</div>");
dcol.addClass('panelcolumn');
return dcol.width(amt); return dcol.width(amt);
}; };
@ -373,7 +374,11 @@ l__________/__________|___|______l__________j_____j
case _this.keycode('x'): case _this.keycode('x'):
return _this.changescrolldirection(1); return _this.changescrolldirection(1);
case _this.keycode('c'): case _this.keycode('c'):
return _this.panelmode(); return _this.panelmode(1);
case _this.keycode('i'):
return $('div.infobox').toggle();
case _this.keycode('v'):
return $('h6').height((window.innerHeight - $('.scrolly').height()) / 2);
case _this.keycode('1'): case _this.keycode('1'):
return _this.changespeed(1); return _this.changespeed(1);
case _this.keycode('2'): case _this.keycode('2'):
@ -387,6 +392,14 @@ 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 40:
return _this.moveline(1);
case 38:
return _this.moveline(-1);
case 34:
return _this.moveline(40);
case 33:
return _this.moveline(-40);
case _this.keycode('h'): case _this.keycode('h'):
$('.help').css({ $('.help').css({
'left': '33%' 'left': '33%'

File diff suppressed because one or more lines are too long

View file

@ -1,14 +1,9 @@
(B) 2015-02-22 ADF @OTHER
(B) @EDITOR add more Amiga fonts. (B) @EDITOR add more Amiga fonts.
(B) @EDITOR redo filenames to load from list of files in directory (specfied in 'location') (B) @EDITOR redo filenames to load from list of files in directory (specfied in 'location')
(A) remove the SAUCE lines at bottom, return ANSI object for render @SAUCE
(A) XBIN @OTHER
(C) Amiga ANSI @OTHER (C) Amiga ANSI @OTHER
(B) Avatar @OTHER
(B) BIN @OTHER
(B) IDF @OTHER
(B) PCBOARD @OTHER
(D) THUMBNAILS - for returning to partymeister @PARTYMEISTER (D) THUMBNAILS - for returning to partymeister @PARTYMEISTER
(B) Tundra @OTHER
(D) implement package import from partymeister @PARTYMEISTER (D) implement package import from partymeister @PARTYMEISTER
(D) hook for progress @progress @PARTYMEISTER (D) hook for progress @progress @PARTYMEISTER
(C) SAHLI ansi & ascii for load page
(C) redo load page (not popup, info)
(B) Preload