jwz - im in ur browser, melting ur digits [entries|archive|friends|userinfo]
jwz

  www.jwz.org
  userinfo
  archive
  rss

Links
[»| [DNA Lounge] [Blog] [iCal] ]
[»| [DNA Lounge Legal Defense Fund] ]
[»| [WebCollage] [LJ WebCollage] ]

im in ur browser, melting ur digits [Sat, 27-Jun-2009 6:33 PM]
Previous Entry Add to Memories Tell a Friend Next Entry
[Tags|, , , , ]
[music |Duran Duran -- Yo Bad Azizi]

Dali Clock Javascript!

I factored out the Javascript from the Palm Pre port of Dali Clock, so now it works as a web page too, including all the display options.

If any of you browser-internals types have suggestions on how to get better performance out of the <canvas> tag (specifically in the Palm Pre version of Webkit) I'd love to hear them.

linkReply

Comments:
[User Picture]From: [info]jered
Sun, 28-Jun-2009 1:53 AM (UTC)

(Link)

Awesome, thanks.

The canvas is misplaced when rendered in Firefox 3.0, btw. Looks right in Safari 4.
[User Picture]From: [info]jwz
Sun, 28-Jun-2009 2:04 AM (UTC)

(Link)

Bleh. Hopefully someone will send me a patch.
[User Picture]From: [info]vanbeast
Sun, 28-Jun-2009 2:46 AM (UTC)

(Link)

set #clockbg to position:relative and you're most of the way there.

I suppose I can make that a diff if you want.
[User Picture]From: [info]jwz
Sun, 28-Jun-2009 2:47 AM (UTC)

(Link)

Most?
[User Picture]From: [info]vanbeast
Sun, 28-Jun-2009 2:51 AM (UTC)

(Link)

Pretend I didn't say that part. I thought it made the clock off-center but I'm too stupid to see that there's space reserved for a two-digit hour.
[User Picture]From: [info]captain18
Sun, 28-Jun-2009 2:50 AM (UTC)

(Link)

Looks like there is a way to support <canvas> for IE7/IE8 with a javascript include. Adding it in got me as far as a green canvas and this error:

Message: 'char_width' is null or not an object
Line: 352
Char: 5
Code: 0
URI: http://www.jwz.org/xdaliclock/javascript/daliclock.js


That's about as far as my limited abilities get me, in case anyone else is industrious enough to try and take it further.

Edited at 2009-06-28 02:50 am (UTC)
[User Picture]From: [info]scullin
Tue, 30-Jun-2009 12:14 AM (UTC)

(Link)

It's possible to plow through a few annoying IEisms to reveal that the js canvas won't sustain a framerate that is remotely interesting.

Plus you'll never get me to submit a patch to Jamie titled "Internet Explorer Support".
[User Picture]From: [info]jarodrussell
Sun, 28-Jun-2009 6:05 AM (UTC)

(Link)

Nifty!
[User Picture]From: [info]jwz
Sun, 28-Jun-2009 8:19 AM (UTC)

simple pleasures

(Link)

I loaded that page into the Pre's web browser. I giggled.
[User Picture]From: [info]jfedor
Sun, 28-Jun-2009 10:39 AM (UTC)

Re: simple pleasures

(Link)

It also appears to work in the Android browser. At least on the emulator.
[User Picture]From: [info]marmoset
Sun, 28-Jun-2009 12:37 PM (UTC)

Re: simple pleasures

(Link)

Works in Safari on iPhone OS 3.0, too.
[User Picture]From: [info]boggyb
Sun, 28-Jun-2009 9:15 AM (UTC)

(Link)

Cool, I can now run Dali Clock on Windows (well, in a browser on Windows but that's close enough)!

I've spotted a couple of bugs/glitches with it:

Glitch 1: the Orientation setting doesn't work properly. The only visible effect is that the font is larger with "Left" and "Right" than it is with "Up" and "Down" - in all cases, the numbers are not rotated. Tried with Opera 9.64 and Firefox 2.0.0.18.

Glitch 2: with anti-aliasing off, picking "Left" or "Right" for Orientation makes the numbers go off the sides of the background.
[User Picture]From: [info]jwz
Sun, 28-Jun-2009 9:21 AM (UTC)

rotation

(Link)

I guess it's not too surprising that
this.canvas.style.webkitTransform = 'rotate(90deg)';
doesn't do much in browsers not based on Webkit.
[User Picture]From: [info]luserspaz
Sun, 28-Jun-2009 11:14 PM (UTC)

Re: rotation

(Link)

Firefox 3.5 added CSS transform support, you can set it in CSS using -moz-transform, or via the DOM using element.style.MozTransform.

https://developer.mozilla.org/En/CSS/Using_CSS_transforms
[User Picture]From: [info]jwz
Mon, 29-Jun-2009 2:24 AM (UTC)

Re: rotation

(Link)

Thanks. Fixed. I assume someday it will be just 'transform', so I set all three.
[User Picture]From: [info]loic
Mon, 29-Jun-2009 3:21 AM (UTC)

Re: rotation

(Link)

I love that in the shiny friendly web standards world of Gecko and WebKit we don't have any more competing proprietary html extensions.
[User Picture]From: [info]jsbowden
Sun, 28-Jun-2009 3:03 PM (UTC)

(Link)

I love that this chews up sixty percent of an entire processor core, go javascript go!
[User Picture]From: [info]fanf
Sun, 28-Jun-2009 10:09 PM (UTC)

(Link)

7% of a core with Safari 4 beta on my 2.4GHz MacBook. I can't tell how much of my iPod it uses :-)
[User Picture]From: [info]luserspaz
Sun, 28-Jun-2009 11:14 PM (UTC)

(Link)

It's pretty low (< 5%) on my Firefox trunk nightly on Windows.
[User Picture]From: [info]lionsphil
Sun, 28-Jun-2009 11:40 PM (UTC)

(Link)

Seeing as people are comparing, 10% of a six-year-old Athlon box under Opera 9/Win.
[User Picture]From: [info]lloydwood
Mon, 29-Jun-2009 9:38 PM (UTC)

Needs a configuration option

(Link)

It should show the time in hexadecimal. I want to see the clock strike C:00:00.
[User Picture]From: [info]sheilagh
Tue, 30-Jun-2009 1:41 AM (UTC)

(Link)

that's so hypnotically addictive to just... watch!
[User Picture]From: [info]jakenelson
Tue, 30-Jun-2009 4:12 PM (UTC)

Awesome

(Link)

that's just fantastic.

One bug: if you set date to YMD, it shows as 09106130 (with the spacer 1s overlapping the following digit), instead of 09-06-30.