//TODO: professional stuff of software engineerĀ 1001010
Testing JavaScript Clocks

Here’s a quick little experiment to show the current time, as a time_t number of seconds since the Linux epoc, displayed as a code39 barcode. That feels nice and geeky šŸ™‚

This is just a proof of concept, I doubt the barcode will scan. It’s based upon c39 font typed into mspaint and cut up into pieces šŸ˜‰ The fun parts were..

  • Chopping up the barcode symbols. Ā It was a flashback to old school icon editing
  • Getting WordPress to not muck up the javascript – use HTML view & check it again if you switch back to visual editor.
  • Put a “window.onload = MyFunc();” at the bottom of your script block. Feels dirty overwritting the onload event & not adding it to a list of functions to call
  • switched to using window.addEventListener – feels sooo much cleaner than window.onload
  • preloading the images to cut down on flicker as an image is used for the first time
  • getting everything to work in my non-primary browsers

Now to search for the right css that will keep the div tag from word wrapping it’s image contents. Ā That initial load on some browsers is annoying. If you care to do something like this – view the source – it’s all there. Longer term

  • Test that the generated c39 symbology is valid. Ā I’m sure theĀ asterisks at the start and end are fine – I’veĀ stared at enough barcodes to recognize that at least šŸ˜‰
  • Shrink it & put it in the side bar
  • Maybe do a QR Code clock? Ā That could be interesting

About