//TODO: professional stuff of software engineer 1001010
Category Archives: JavaScript
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 🙂

blankasterik1743877405asterikblank

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