Merge pull request #7 from lastebil/develop

Add 'previous' capability
This commit is contained in:
Per Persson 2016-09-27 22:29:09 +03:00 committed by GitHub
commit 58ba2141f4
5 changed files with 84 additions and 12 deletions

View file

@ -6,7 +6,7 @@
l__________/__________|___|______l__________j_____j
Ansi/Ansi Viewer in Ecmascript
Coded by Sir Garbagetruck / Accession 2013
Coded by Sir Garbagetruck / Accession 2013+
Uses fonts by DMG, http:trueschool.se
Uses SixteenColors textmode js library for rendering
(well, my optimized version...)
@ -63,6 +63,34 @@ This works just fine if you use remote urls for the files.
EVERY PERSON ALIVE, DEAD, OR IMAGINARY,
INCLUDING THE NONEXISTENT. ***
Mr Doob (who I want to call Trace (: ) has a good page
explaining how to do this and alternatives here:
https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
As you can see from that, as of right now (September 2016)
if you're using Firefox, you should be EXTREMELY CAREFUL and be
100% SURE YOU CHANGE THE SETTING BACK!
** ESPECIALLY ON WINDOWS FOR CRYING OUT LOUD **
Look if you're using Windows and Firefox to use this, and _YOU_
don't set the setting back, YOU ARE GOING TO GET FUCKED.
BECAUSE OF THIS: I DO NOT RECCOMEND, OR SUPPORT, RUNNING THIS
ON WINDOWS AND FIREFOX. It works. I do not RECCOMEND it or
support it. Someone is going to come back and fuck me over
because of their stupidity and choice of OS. Fuck that.
I may be able to turn this into a chrome app at some point, which
will eliminate that issue. Possibly also a Firefox solution, but:
As of today: I do not support this on Windows + Firefox. That is
100% at your own risk, because of the possibility you will forget
to set the setting back.
It's just plain safer to install this on your webserver at the
party place in a directory and use _that._
This product is licensed under the WTFPL. See:
http://www.wtfpl.net
for details, or just get the license:
@ -98,3 +126,8 @@ Azzarro/Madwizards.
- More examples came from 16colors archive. When the final
Sahli ver. B comes out, I'll select some test files and
put those credits in here too.
- Thanks to M0qui for submitting a patch for 'backwards'
(in case you accidentally hit space. Which we c64 sceners
never do, because that would be the NEXT demopart, and
you'd have to reload (: )

View file

@ -41,6 +41,8 @@
<li><span class="key">W</span> Begin scrolling upward</li>
<li><span class="key">A</span> Stop scrolling</li>
<li><span class="key">P</span> Previous Picture</li>
<li><span class="key">T</span> Jump to Top of picture (resets zoom)</li>
<li><span class="key">B</span> Jump to Bottom</li>
<li><span class="key">1</span><span class="key">2</span><span class="key">3</span><span class="key">4</span><span class="key">5</span> Alter scrollspeed (fast -> slow)</li>

View file

@ -146,6 +146,13 @@ class @Sahli
$('body').stop()
@loadinfopanel i
@prevpic = =>
i = @currentpic-2
if i < 0
i = i + @filedata.length
@currentpic = i
@nextpic()
@togglefullscreen = ->
docElm = document.documentElement
if @fullscreen
@ -315,6 +322,8 @@ class @Sahli
switch ev.which
when @keycode ' '
@nextpic()
when @keycode 'p'
@prevpic()
when @keycode 'f'
@togglefullscreen()
when @keycode 's'

View file

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.9.0
// Generated by CoffeeScript 1.9.3
/*
.___________________________________, ___
@ -172,6 +172,31 @@ l__________/__________|___|______l__________j_____j
return Sahli.loadinfopanel(i);
};
Sahli.prevpic = function() {
var filedata, i, viewbox;
viewbox = $('div#sahliviewer');
viewbox.children().remove();
$('#panel').empty();
Sahli.scroll_direction = 1;
Sahli.scroll_speed = 5;
filedata = Sahli.filedata;
i = Sahli.currentpic - 2;
if (i < 0) {
i = i + filedata.length;
}
filedata[i].pic = $('<h6>' + filedata[i].file + '</h6>');
viewbox.append(filedata[i].pic);
Sahli.loadpic(filedata[i], filedata[i].pic);
Sahli.currentpic = i + 1;
if (Sahli.currentpic > filedata.length - 1) {
Sahli.currentpic = 0;
}
$('#panel').hide();
$('#outbox').show();
$('body').stop();
return Sahli.loadinfopanel(i);
};
Sahli.togglefullscreen = function() {
var docElm;
docElm = document.documentElement;
@ -281,7 +306,7 @@ l__________/__________|___|______l__________j_____j
};
Sahli.panelmode = function() {
var canvs, ct, drawcol, level, newheight, newwidth, numcols, numpanels, outer, panelratio, panelslotheight, panelsperslot, pic, picdpercol, screenratio, wh, ww, x, _i, _j, _len, _len1, _results;
var canvs, ct, drawcol, j, k, len, len1, level, newheight, newwidth, numcols, numpanels, outer, panelratio, panelslotheight, panelsperslot, pic, picdpercol, results, screenratio, wh, ww, x;
$('#panel').toggle();
canvs = $('canvas');
$('.scrolly').width(this.origwidth);
@ -309,9 +334,9 @@ l__________/__________|___|______l__________j_____j
drawcol = 1;
ct = 0;
outer.append(this.createpanel(1, newwidth - 6));
_results = [];
for (_i = 0, _len = canvs.length; _i < _len; _i++) {
pic = canvs[_i];
results = [];
for (j = 0, len = canvs.length; j < len; j++) {
pic = canvs[j];
$("#column" + drawcol).append(pic);
level += 1;
ct += 1;
@ -319,19 +344,19 @@ l__________/__________|___|______l__________j_____j
level = 0;
drawcol = drawcol + 1;
if (ct < numpanels) {
_results.push(outer.append(this.createpanel(drawcol, newwidth - 6)));
results.push(outer.append(this.createpanel(drawcol, newwidth - 6)));
} else {
_results.push(void 0);
results.push(void 0);
}
} else {
_results.push(void 0);
results.push(void 0);
}
}
return _results;
return results;
} else {
$('#outbox').show();
for (_j = 0, _len1 = canvs.length; _j < _len1; _j++) {
pic = canvs[_j];
for (k = 0, len1 = canvs.length; k < len1; k++) {
pic = canvs[k];
$('.scrolly').append(pic);
}
canvs.width(this.origwidth);
@ -374,6 +399,8 @@ l__________/__________|___|______l__________j_____j
switch (ev.which) {
case _this.keycode(' '):
return _this.nextpic();
case _this.keycode('p'):
return _this.prevpic();
case _this.keycode('f'):
return _this.togglefullscreen();
case _this.keycode('s'):

View file

@ -7,3 +7,4 @@
(C) SAHLI ansi & ascii for load page
(C) redo load page (not popup, info)
(B) Preload
(C) Chrome app