Category: Javascript

Drupal YUI Rich Text Editor: Set maximum image dimensions on uploaded images

The search for the perfect WYSIWYG text editor in Drupal goes on. The best I’ve seen yet is YUI Rich Text Editor, but it still has some serious browser incompatibilities and usability problems. One significant is that there is nothing stopping users from upload a huge image, and not resizing it down using the provided resizing tools.

Now that just most cameras produce images of enormous resolution, users in my Drupal sites’ users often upload gigantic photos, which remain splashed across the entire layout until I get around to fixing them. I finally got tired of correcting users’ posts for them and fixed the CSS so it will never happen again.

Continue reading

Multiple JW players on a page, revised for JW Player 4.7

The JW Player is a very popular open-source media player which not only supports many video, audio and image formats, but has many scriptable behaviors. Here we’ll make use of the JavaScript API to generate as many players as you want on a page. The generated players all have separate event listeners to keep them from interfering with each other. Events or actions executed in one player do not affect others.

Article Outline

  • Add placeholders for each player
  • Playlists
  • Call the init function
  • This is a new version of that was compatible with an earlier version of the JW Player. This one has been updated to work with JW Player 4.7.761 and later.

  • Continue reading

    Pass data to a Qualtrics survey and display it in the survey and reports

    Qualtrics is an online survey application with many capabilities that aren’t obvious at first glance. I’m currently using Qualtrics to create a feedback form that will be used in several hundred learning modules. This form needs to recognize from which learning module it’s being accessed, and it should determine the author of the module and email them a copy of the user’s feedback.

    Qualtrics has a feature called “embedded data” which allows you to pass any arbitrary arguments in the link to the survey. We’ll use this to add metadata to the feedback.

    There are three steps:

    1. Set up a link to the survey that passes “Embedded Data” values
    2. Set up the survey to access the Embedded Data
    3. Do something with the Embedded Data
    Continue reading

    JW FLV player with Javascript playlist

    Screen shot 2009-12-17 at 1.06.07 PM.jpg

    This is an example of how to create a javascript-based Playlist selector for a JW FLV player. The playlist selector menu has 3 sections that toggle open and closed when you click on them. This allows the user to switch playlists, choosing from various topics.

    The source code has not been cleaned up, but you should be able to get an idea of how to set this up from it.

    Continue reading

    jQuery UI Accordion does not function in IE7/WinXP

    The Accordion is one of the handy interface widgets that can be generated using jQuery UI. There are several optional settings you can add into the function call, including animation, auto-height, etc. If you find it is not working on IE7try adding “animated:false” as one of the options.

    If you are running a debugger on IE, and see the error “invalid option on line 486” this is definitely the problem.

    Screen shot 2009-12-10 at 12.37.41 PM.jpg

    Continue reading

    Infinite JW FLV players on a page, with error catching for Red5 bug

    NOTE: this has been revised to make it more flexible, and allow multiple streamers and multiple video types, using the same code.

    This is a script that allows you to add as many JW FLV players to a page as you want, using a single block of code. The players all have separate event listeners to keep them from interfering with each other. Events or actions executed in one player do not affect others.

    This particular demo also corrects for a problem we have noticed recently with Red5, where RTMP streams will hang with a “BUFFER.EMPTY” status code. I’ve set up meta-monitoring so that it catches “BUFFER.EMPTY” codes and starts the player up again a little bit previous to the break. It creates player names and function names dynamically, based on how many players you request. If this function seems to be giving you problems, if your videos start jumping back and restarting a lot, search for the following line and comment it out by adding “//” in front of it:

    window["player_"+obj.id].sendEvent('SEEK', parseInt(window["positionarray_"+obj.id][3])+100);
    

    We’ve also had problems with some videos that simply refuse to stream, although they will play using progressive download. You can use a mixture of streaming and non-streaming by altering the playlist for each video.

    Screen shot 2009-10-30 at 5.44.32 PM.jpg


    Continue reading