Archive for February, 2009

Memo: jQuery AJAX Settings Object

26th February 2009

The jQuery documentation fails to provide information about exactly what options you can pass to $.ajax.  So here is my quick-and-dirty list:

  • url: string (location.href)
  • global: bool (true) — whether to trigger the global ajax events
  • type: “GET”/”POST” (“GET”)
  • contentType: string (“application/x-www-form-urlencoded”)
  • processData: bool (true)
  • async: bool (true)
  • timeout: int (null)
  • data: object (null)
  • username: string (null)
  • password: string (null)
  • xhr: function – creates the XMLHttpRequest object
  • accepts: object ({ xml: “application/xml, text/xml”, html: “text/html”, script: “text/javascript, application/javascript”, json: “application/json, text/javascript”, text: “text/plain”, _default: “*/*” })
  • dataType: “html”/”text”/”xml”/”json”/”jsonp”/”script”
  • cache: bool (true, unless dataType=script)
  • ifModified: bool (false) — set the If-Modified-Since header (to last request time)
  • beforeSend: function(xhr, settings) (null) — return false to cancel
  • success: function(data, “success”) (null)
  • complete: function(xhr, status) (null) — status is “timeout”/”error”/”notmodified”/”success”/”parsererror”
  • error: function(data, status) (null) — status is “timeout”/”error”/”parsererror

Note to self: format this into a table at some point.

Edit: the documentation has now been fixed, and includes all the options.

Now Playing with Art

21st February 2009

Michael Pyne added support for album art to Juk‘s D-Bus interface, and modified the now playing dataengine to get this artwork.  The dataengine already supported getting artwork from MPRIS-enabled players, and Amarok has provided album artwork over MPRIS for a while.

So I’ve now added the display of album artwork to the now playing widget:

The Now Playing applet with album artwork

The Now Playing widget with album artwork

Naturally, this disappears (and the text moves over to the left) when there is no album artwork available, and the image resizes to be as tall as the text when you resize the widget.

Oh, and I fixed the scrollbars to work when you use the mouse wheel on them.  This fix will be in the next release of 4.2 (although the artwork won’t be).

Now I need to improve the functionality of the widget when it’s on the panel.  And any help in generally making the widget prettier would be most welcome.  I really don’t like the scrollbars, and the album art needs a frame.


Follow

Get every new post delivered to your Inbox.