From 56fb44d1f8ea0a77e5aecc6e9f36e9633b13e10e Mon Sep 17 00:00:00 2001 From: Iam Naughton Phier Date: Tue, 17 Feb 2015 16:53:45 +0200 Subject: [PATCH] this is cleaner --- index.html | 5 +++++ sahli.coffee | 63 ++++++++++++++++++---------------------------------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/index.html b/index.html index 7df285f..ce26e7c 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,11 @@ --> + diff --git a/sahli.coffee b/sahli.coffee index bd0da94..c4af151 100644 --- a/sahli.coffee +++ b/sahli.coffee @@ -12,28 +12,27 @@ l__________/__________|___|______l__________j_____j Uses Andy Herbert's Ansilove.js for rendering. ### -exports = Sahli - -Sahli = -> - @outbox = $('div#outbox') - @dbox = $('div#drawbox') - @image = 0 - # scroll speed of 5 looks ... "ok" on macbook pro. 4 was original. - @scroll_speed = 5 - @scroll_direction = 1 - @zoomspeed = 200 - @asciiasgfx = true - @DEBUG = false - @dbox.height document.height - 24 - @dbox.width document.width - 2 - @sizemult = 16 - # 32 is larger than screen, and somewhat silly - @origheight = 0 - @origwidth = 0 - @filedata = '' - @slides = 0 - @currentpic = 0 - @nonfsheight = document.height - 40 +class @Sahli + constructor: () -> + @outbox = $('div#outbox') + @dbox = $('div#drawbox') + @image = 0 + # scroll speed of 5 looks ... "ok" on macbook pro. 4 was original. + @scroll_speed = 5 + @scroll_direction = 1 + @zoomspeed = 200 + @asciiasgfx = true + @DEBUG = false + @dbox.height document.height - 24 + @dbox.width document.width - 2 + @sizemult = 16 + # 32 is larger than screen, and somewhat silly + @origheight = 0 + @origwidth = 0 + @filedata = '' + @slides = 0 + @currentpic = 0 + @nonfsheight = document.height - 40 @loadpic = (picdata, inserthere) -> switch picdata.filetype @@ -195,26 +194,8 @@ Sahli = -> document.webkitCancelFullScreen() return - @fixhelpbox = -> - h = $('.help') - xy = - 'top': 0 - 'left': document.width / 2 - h.width() / 2 - h.css xy - return - @toggledebug = -> $('h1#top').fadeToggle() @DEBUG = !@DEBUG return - - - @loadkeys() - @fixhelpbox() - ref = this - $(window).resize -> - ref.resizedrawbox() - return - debugger - @requestsahlifile 'list.sahli' - return + \ No newline at end of file