The JavaScript code might need some cleanup:

  • Limit the use of global vars (e.g. drupalchat, chatboxtitle)
  • Maybe refactor using http://stefangabos.ro/jquery/jquery-plugin-boilerplate-revisited/?
  • Limit the amount of JQuery(selector)-calls, e.g.

    jQuery("#chatbox_"+chatboxtitle+" .subpanel").doThis();
    jQuery("#chatbox_"+chatboxtitle+" .subpanel").doThat();

    should become

    var $chatbox = jQuery("#chatbox_"+chatboxtitle+" .subpanel");
    $chatbox.doThis();
    $chatbox.doThat();
  • Remove deprecated jQuery functions, e.g. jQuery.live
  • Add comments and documentation