Karl's Archive

Half-Star Rating Plugin



There was a request recently on the jQuery discussion list for an enhancement to Ritesh Agrawal’s Simple Star Rating System to allow for 1/2 star ratings. So I took it upon myself to add the feature.

Keep in mind that this plugin does not “degrade” when the browser doesn’t have JavaScript or when JavaScript is disabled. The the elements for the stars are created by the jQuery code, so when JavaScript isn’t available, the elements don’t appear. Therefore, if you are not absolutely certain that visitors to your site will have JavaScript available, this plugin probably isn’t the best solution for you. (See Wil Stuckey’s jQuery Star Rating Plugin for a degradable option.)

My addition to the plugin is pretty simple. It just adds another option to the settings, called increment, so you can do something like this now: $('#rate1').rating('example.php', {maxvalue: 5, increment: .5});. If no increment value is set, or if it’s greater than or equal to .75, the plugin will use whole-star increments. If the value is less than .75, it’ll use half-star increments. Here you can see it in action:

 

I also updated Ritesh’s demo page to include the new example: Simple (Half) Star Rating System. If you like it, you can download the files from there.

Update

I’m not supporting my version of this plugin at this time. I meant it more as a proof of concept, an attempt to help an individual on the jQuery discussion list. If you need a plugin with the half-star feature, I’d recommend Diego A’s Star Rating Plugin.

jquery.com back up

The jquery.com site is up and running again. The DNS is still propagating across the net, so it might not be available quite yet from every location, but it should be fully reachable within the next day.

I’ll leave source files on my server for the next couple days, so feel free to grab them from here (see previous post for details) if you’re still not able to get to jquery.com.

Thanks, everyone, for your patience.

Also, if you’d like to donate a few bucks to help John with the setup costs for the new web host, you can do that here or on the jquery.com home page:

jquery.com temporarily down

As most of you have probably noticed, the jquery.com web site is down. John Resig has posted an explanation of what is going on, but you might not be able to see it depending on your DNS settings. Here is a copy of his words, taken from his post to the discussion list:

Sat. May 5th 6pm: We suffered our second DDOS attack today and our host has asked us to no longer host the jQuery site with them. Effective immediately they have shut down all services on the jQuery server and asked us to leave. This has taken us completely by surprise and we’re working to adapt.

Sat. May 5th 11pm: Most of Saturday has been spent scrambling to offload copies of files onto other servers and to find a new host. All files have been backed up, so that is promising in-and-of itself….

Sun. May 6th 1am: An order has been placed with Rimuhosting to acquire a dedicated server for jQuery. We’re hoping that the server will be ready some time Sunday, or at the latest, Monday. All files will be immediately moved over and attempts will be made to get everything in order.

Sun. May 6th 2pm: No update from Rimu as of yet, here’s hoping they come through in a reasonable amount of time.

Also, I’ve placed yesterday’s SVN builds of jquery.js and all of the plugins at http://www.learningjquery.com/src/. Keep in mind that these are not release versions, but development versions, so please do not use them for “production” code. If someone has the latest stable release and is willing to provide a link to it, please post it in a comment. Or, send me the file (my first name at learningjquery.com) and I’ll post it here.

Latest Stable Releases:

jquery-latest.js
jquery-latest-pack.js
If you need to view the API reference, don’t forget these two excellent resources available to you: Visual jQuery and jQuery API.

UPDATE FROM JOHN RESIG:

Sun. May 6th 6pm: Just got word from Rimu that the server is being set up, and will be ready “within 12 hours”. Thanks everyone for the donations that are pouring in, I appreciate it! NOTE Temporary downloads are back up!

Thanks for hanging in there through this ordeal!

Learning jQuery, the Book

For those of you who have been following the jQuery blog the past couple months, you may have noticed John Resig’s mention of a secret: “There’s a jQuery book in the works!” Well, I am thrilled to be able to leak a little more information about that secret.

For the past few months my friend Jonathan Chaffer and I have been hard at work on the book, and everything is progressing well. Our writing is being supported by a stellar group of technical reviewers, some of whom are members of the jQuery development team. We’ll be able to divulge details about the book’s contents soon. The publisher is readying a web page for it, so as soon as that is completed, we can give you the full scoop.

About the Authors

Jonathan Chaffer is a long-time Drupal contributor and creator of Drupal’s CCK. He also likes to make up bizarre band names and album titles, based on snippets of conversations he overhears, at Tweak the Viking. Karl Swedberg (that’s me) is a jQuery zealot who runs the Learning jQuery blog and still tries to keep a bit of his former career as an English teacher alive at his other blog, English Rules. Jonathan and Karl work together at Structure Interactive in Grand Rapids, Michigan, where they have been given a lot of freedom to use jQuery, as well as standards-based, semantic HTML & CSS, in many of their projects.

Accordion Madness


A few weeks ago I wrote about two ways we can achieve the “accordion menu” effect, and I promised to describe a third option. Well, this is it, Option 3. But first, here is a list of my other show-hide-toggle entries, as well as Jörn Zaefferer’s accordion menu plug-in:

Read the rest of this entry »

jQuery 1.1.2 Released

The jQuery project team has just released version 1.1.2 of the JavaScript library. This is a bug-fix version, recommended for everyone. If you are still using a version prior to 1.1, you should be mindful of the API changes (see the jQuery 1.1 announcement for details). If you’re already using version 1.1 or later, you’re in good shape.

Here are the “new and noteworthy” updates from version 1.1 to version 1.2, as noted in the Change Log:

  • Changed: Event handlers (like element.onclick) are now removed when no more functions are bound to the event.
  • Fixed: DOM Manipulations for form elements.
  • Fixed: jQuery.isFunction to return false on nodes.
  • Fixed: jQuery.className.has, escaping regex characters in className (for metadata)
  • Fixed: an issue in IE where an event on a cloned element is fired during a .clone() inside of an event handler.
  • Fixed: IE ID selectors selecting by the name attribute.
  • Changed: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
  • Changed: .attr('href') is now consistent in all browsers.
  • Changed: @href is now consistent in all browsers.
  • Fixed: the slideDown flickering bug.
  • Fixed: Having a \r endline in $("...") caused a never-ending loop.
  • Fixed: IE6 AJAX memory leak
  • Fixed: bug in pushStack, reporting an element at [0] in a jQuery object with length 0

Download the jQuery 1.1.2 source directly, or visit the jquery.com download page.

Important Update: If you downloaded 1.1.2 between the time I originally posted this entry and now (2007-02-28T17:12:00+10:00), please download it again. There was a nasty Safari-crashing issue with the one posted last night.