Posts Tagged ‘javascript’

Oct 24, 2008

Javascript color manipulation

Recently I needed to write some code which involved matching any given colour against a custom palette of colours. I found it hard to find any decent javascript out there... So I wrote my own.

Introducing: Color Utils

Main features:

  • Convert any colour format to any other colour format
  • Match colours against a custom palette
  • Match colours against a websafe palette
  • Increase/decrease Hue, Saturation and Brightness of a colour
  • Find different colour harmonies for a color
  • Fade from one colour to another
  • Easy to use
  • No dependancies such as prototype or jQuery
  • Small file size. Just 11kb!

Color Utils

Enjoy! http://www.madebypi.co.uk/labs/colorutils/

Sep 10, 2008

jParallax

While undertaking some late night internet browsing I came across an interesting jQuery plugin called jParallax.

The plugin's website describes it best.

"Parallax turns a selected element into a 'window', or viewport, and all its children into absolutely positioned layers that can be seen through the viewport. These layers move in response to the mouse, and, depending on their dimensions (and options for layer initialisation), they move by different amounts, in a parallaxy kind of way."

Seeing is definately believing with this plugin, so head on over to their website and see it in action.

Aug 20, 2008

BBC Trial in page links

For a limited period the BBC News Website is experimenting with clickable links within the body of news stories. If you click on one of these links, a window will appear containing background material relevant to the  highlighted word. Content is being pulled in from sites like YouTube, Flickr and Wikipedia and it seems to be done pretty well.

Read more about it here

Check out this Jeremy Clarkson story for an example

Jul 25, 2008

Opera, XSLT and tags

I think I've discovered a pretty big bug in Opera browser when testing client-side XSLT capabilities of different browsers.

Steps to reproduce:

  1. Launch Opera
  2. Disable Javascript
  3. Visit a XSLT page that uses javascript in part of an xslt template (not one that users javascript to actually do the transformation)
  4. The moment the parser encounters a <script> tag within a template, it'll fail.

This is really frustrating because I've found that most of the other browsers are doing a good job with XSLT these days.

Jul 24, 2008

JSON character encoding

It appears the encoding of a JSON file must match the encoding used in the HTML page which is downloading it. If a page uses UTF-8 encoding but the JSON file uses iso-8859-1 (or visa versa) then any unicode characters in the JSON may not be decoded and displayed properly.
(more...)