Website Improvements #8: JavaScript and the Editor

Summary for those who aren’t interested in the details:

  • The site should load faster
  • Menu reordering is easier
  • You can now copy and paste directly from Microsoft Word

JavaScript is a programming language used by your web browser that allows it to manipulate the web page after the server is done creating it. For example, we can use JavaScript to tell the web browser to open a box with a story in it on our site’s home page when you click on one of the bars. This gives web developers and designers a lot of flexibility when creating the site.

However, the historical problem with JavaScript is that different browsers implement the language in different ways. Microsoft Internet Explorer, Firefox, and Apple’s Safari each have slightly different versions. To solve this problem, we use a JavaScript library, called jQuery, that provides a unified interface to all these different versions of the language. Of course, it’s not that simple. Drupal uses one version of jQuery, but the version it uses can’t do cool things like our homepage waveform. So for the last ten months our site has been running two versions of jQuery simultaneously.

If that sounds like a lot of added, unnecessary overhead, it is. We’ve now updated the site to work with just the newest version of jQuery running. What this means is that there are no longer odd conflicts between the two versions. Anyone who has tried to reorder a menu on their site knows that these conflicts can sometimes be painful. Now when you reorder the menu the item slides as expected, rather than jumping all over the place. Additionally, you don’t need to download both versions (which your browser does in the background when you visit the site), so our pages will load faster for new visitors.

This change also allowed us to update the WYSIWYG editor that you use when composing updates on the site from TinyMCE version 3.2.1.1 to 3.3.9.2 (here’s a complete list of the changes). The big change is that the editor now does a significantly better job of formatting and will automatically clean up formatted text that you paste in – such as text you’ve composed in Microsoft Word or in an email – without you needing to use the Paste from Word or Paste as Plain Text buttons. We left the buttons in just in case.

We think we’ve worked out most of the issues with these changes at this time, but be sure to let us know if something else isn’t working.

Leave a Reply

Your email address will not be published. Required fields are marked *