HotPot on Safari

HotPot on Safari

by Gordon Bateson -
Number of replies: 4
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Safari fans!
I have spent the last couple of days in a Mac room, investigating reports that HotPots don't run on Safari. The main symptoms were incorrect scores (400% and more!) and a freezing of the browser when clicking the check button.

It turns out there were some big problems. The root cause is that on Safari the function.toString() does not return a valid function. In particular:
  • myString.replace(/search expression/, 'replacement string');
    changes to
    myString.replace(search expression, 'replacement string');
    i.e. the slashes, "/", are removed
  • for (var i=0; i<i_max; i++) { }
    changes to
    for (i=0; i<i_max; i++) { }
    i.e. the local variable "i", becomes a global variable
  • (x-y)/z
    changes to
    x-y/z
    i.e. the parentheses are removed from mathematical expressions. FYI x-y/z = x-(y/z) which is usually not the same as (x-y)/z. For example, if x=4, y=0 and z=4, then (x-y)/z = (4-0)/4 = 1, but x-(y/z) = 4 - (0/4) = 4.
This causes major problems for the HotPot module, because it tries to modify the standard Hot Potatoes functions after the quiz has loaded in the browser, and it does this using the "toString()" function.

After much trail and tribulation, I was finally able to work out what was going on and fix the HotPot Javascript to work around this curious Safari behavior. Currently, I have updated Moodle 1.6, and will make similar changes to 1.7, 1.8 and HEAD in the next few days.

While, I was at it, I incorporated the "source" templates from Hot Potatoes 6.2 into the HotPot module, and modified the HotPot javascript, to take account of the fact that the delimiter used to separate student guesses has been standardized to " | ". Previously, the delimiter had been "," or "|". The change in delimiter was the reason that "ignored" values were not being currently extracted and returned to Moodle.

all the best!
Gordon

P.S. On re-reading this post, I think I may not have explained things particularly clearly, but the long and the short of it is that Moodle 1.6 now uses Hot Potatoes 6.2 templates and is compatible with Safari (as well as all other modern browsers known to me). Moodle 1.7, 1.8 and HEAD will be updated soon.

Average of ratings: -
In reply to Gordon Bateson

Re: HotPot on Safari

by Martin Holmes -
That's great news. What's HEAD?

Cheers,
Martin
In reply to Martin Holmes

Re: HotPot on Safari

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Martin,
sorry for any confusion. "HEAD" is the leading development branch of the Moodle CVS depository. It is the latest, latest Moodle. It's so much in front that it has not been released yet. But one day it will become the next release of Moodle.

CVS is a great way to keep your Moodle site uptodate. 

There's more information about the HEAD branch of CVS here:
http://docs.moodle.org/en/CVS_for_Developers#Working_with_branches

/

all the best
Gordon

In reply to Gordon Bateson

Re: HotPot on Safari

by Glenys Hanson -
Hello Gordon,

This is great for my Mac using students. I only have a few of them, but I intend my courses to works as easily on the technical front for them as for those on PC.

I'm still going to recommend they use Firefox instead of Safari, though, because there are problems using the html editor in the Moodle wikis and message forums with Safari.

I'm also impressed by the technical complexity of the work you do, "trail and tribulation", to fix problems like this so that mathematical illiterates like myself can use Moodle and HP to attain our pedagogical objectives.

Cheers,
Glenys


In reply to Glenys Hanson

Re: HotPot on Safari

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Glenys (and everyone else!),
regarding which browser to use to view HotPots on Macs, I have found that Safari now works better than Firefox surprise

When viewing a JMatch with Firefox on Mac, if there are any media players in items on the right-hand side, then they become impossible to "drop", once you begin to "drag" them. I have only found this behavior in Firefox on Mac. Firefox on Windows works fine and Safari on Macs works fine. My hunch is that Firefox and Flash are not communicating as they should on the Mac. Bit of a puzzle that.

Anyway, I have now added the HP 6.2 "source" templates to Moodle 1.6, 1.7, 1.8 and HEAD (which will become Moodle 1.9). I also added the Safari fixes. The modified scripts will be available from the Moodle downloads page in due course (usually within 24 hours).

best regards
Gordon