cleanup before testing.

This commit is contained in:
Howland Owl 2013-09-26 15:22:23 +03:00
parent 893b5cf1de
commit 4f48d4d45f

View file

@ -1,7 +1,7 @@
// .___________________________________. ._____.
// | / | | . | |_____|
// | ____ | : | | |
//: |___/ / | | l_____| |
// .___________________________________, ___
// | / | | . \ .(___):
// | _______ | : \ : |
//: |___/ / | | \__| |
//| / | | | |
//l__________/__________|___|______l__________j_____j
//
@ -13,7 +13,7 @@
var Sahli = function() {
this.outbox = $('div#outbox');
this.dbox = $('div#drawbox');
this.image;
this.image = 0;
// scroll speed of 5 looks ... "ok" on macbook pro. 4 was original.
this.scroll_speed = 5;
@ -26,7 +26,10 @@ var Sahli = function(){
this.dbox.height(document.height - 24);
this.dbox.width(document.width - 2);
this.sizemult = 16; // 32 is larger than screen, and somewhat silly
this.origheight, this.origwidth, this.filedata, this.slides;
this.origheight = 0;
this.origwidth = 0;
this.filedata = '';
this.slides = 0;
this.currentpic = 0;
this.nonfsheight = document.height - 40;
@ -42,7 +45,11 @@ var Sahli = function(){
var color = this.calccolor(picdata.color);
var bgcolor = this.calccolor(picdata.bg);
ptxt.addClass(picdata.font.toLowerCase());
ptxt.css({'color':color,'background-color':bgcolor,'margin':'auto'});
ptxt.css({
'color': color,
'background-color': bgcolor,
'margin': 'auto'
});
ptxt.width(picdata.width * 8);
pdiv.width('100%');
pdiv.append(ptxt);
@ -56,7 +63,7 @@ var Sahli = function(){
} else {
// I really should make a real error handler.
alert(req);
};
}
}
};
req.open('GET', picdata.file, true);
@ -66,11 +73,11 @@ var Sahli = function(){
this.image = new ImageTextModeANSI();
this.image.parseUrl(picdata.file);
this.image.renderCanvas(canv);
pdiv.append(canv)
pdiv.append(canv);
inserthere.after(pdiv);
this.origwidth = canv.width;
this.origheight = canv.height;
};
}
infob.find('h1').text(picdata.name);
infob.find('h2').text(picdata.author);
infob.find('h3#text').text(picdata.line1);
@ -89,7 +96,10 @@ var Sahli = function(){
var canv = $('canvas');
var w = canv.width() * amt;
var h = canv.height() * amt;
canv.animate({width:w,height:h},this.zoomspeed);
canv.animate({
width: w,
height: h
}, this.zoomspeed);
};
this.fullwidth = function() {
@ -98,7 +108,10 @@ var Sahli = function(){
this.originalsize(this.zoomspeed);
} else {
var ratio = this.origwidth / this.dbox.width();
$('canvas').animate({width:this.dbox.width(),height:this.origheight / ratio},this.zoomspeed);
$('canvas').animate({
width: this.dbox.width(),
height: this.origheight / ratio
}, this.zoomspeed);
}
};
@ -109,21 +122,27 @@ var Sahli = function(){
this.originalsize(this.zoomspeed);
} else {
var ratio = this.origheight / this.dbox.height();
canv.animate({height: this.dbox.height(), width:this.origwidth / ratio},this.zoomspeed);
canv.animate({
height: this.dbox.height(),
width: this.origwidth / ratio
}, this.zoomspeed);
}
};
this.originalsize = function(zoomspeed) {
// why do we not have origwidth now? hmm.
var canv = $('canvas');
canv.animate({width: this.origwidth, height:this.origheight},this.zoomspeed);
canv.animate({
width: this.origwidth,
height: this.origheight
}, this.zoomspeed);
};
this.toptext = function(text) {
if (this.DEBUG) {
$('h1#top').text(text);
};
}
};
this.setscroll = function() {
@ -142,7 +161,9 @@ var Sahli = function(){
}
this.toptext(this.scroll_speed + ' | ' + steps);
this.dbox.animate({scrollTop : scrollto}, this.scroll_speed*steps ,'linear');
this.dbox.animate({
scrollTop: scrollto
}, this.scroll_speed * steps, 'linear');
};
this.resizedrawbox = function(height) {
@ -212,11 +233,9 @@ var Sahli = function(){
var toid = window.setTimeout(sahli.resizedrawbox, 100);
if (docElm.requestFullscreen) {
docElm.requestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
else if (docElm.mozRequestFullScreen) {
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
else if (docElm.webkitRequestFullScreen) {
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
@ -226,11 +245,9 @@ var Sahli = function(){
var toid = window.setTimeout(sahli.resizedrawbox, 100, this.nonfsheight);
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.mozCancelFullScreen) {
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
};
@ -238,7 +255,10 @@ var Sahli = function(){
this.fixhelpbox = function() {
var h = $('.help');
// var xy = {'top': document.height/2 - h.height()/2, 'left': document.width/2 - h.width()/2};
var xy = {'top': 0, 'left': document.width/2 - h.width()/2};
var xy = {
'top': 0,
'left': document.width / 2 - h.width() / 2
};
h.css(xy);
};
@ -258,7 +278,7 @@ var Sahli = function(){
}
} else {
ref.setscroll();
};
}
});
$(document).bind('keydown', function(ev) {
@ -282,7 +302,7 @@ var Sahli = function(){
ref.resize(2);
break;
case 75: // k
ref.resize(.5);
ref.resize(0.5);
break;
case 79: // o
ref.fullwidth();
@ -366,9 +386,9 @@ var Sahli = function(){
default:
if (ref.DEBUG) {
alert(ev.which);
};
}
break;
};
}
});
};
@ -383,6 +403,5 @@ var Sahli = function(){
};
// Dammit I hate how conttrol-R in textmate is "some shell shit"
// I also hate how scrolling is incredibly stupid on osX
// Mind you, it's better than touching anything in Windows.
// I switched to Sublime text + sublemacs pro.
// Yes, the author of Sublime Text's emacs hatred is annoying.