Skip to: Site menu | Main content

Email Facebook LinkedIn Twitter Google

Blog...

Javascript SCORM API

For anyone that's tried to wade through the mountains of SCORM documentation it can be a little frusrating trying to put all the pieces together.

This is useful if you want to get interaction data out of products like Adobe Captivate, Adobe Presenter, or Articulate.

So I'm providing a very simple SCORM 2004 javascript API that will hopefully be a useful starting point for anyone trying to implement an LMS or SCORM data collector.

<script type="text/javascript">
    window["API_1484_11"] = {
        Initialize: function(parameter) {
            console.log("Initialize: parameter=" + parameter);
            return "true";
        },
        Commit: function(parameter) {
            console.log("Commit parameter=" + parameter);
            return "true";
        },
        Terminate: function(parameter) {
            console.log("Terminate parameter=" + parameter);
            return "true";
        },
        GetValue: function(parameter) {
            console.log("GetValue parameter=" + parameter);
            if (parameter.toLowerCase() == "cmi.completion_status")
                // Default response
                return "incomplete";
            return "";
        },
        SetValue: function(paremter_1,parameter_2) {
            console.log("SetValue: paremter_1=" + paremter_1 + " | parameter_2=" + parameter_2);
            return "0";
        },
        GetErrorString: function() {
            console.log("GetErrorString");
            return "";
        },
        GetDiagnostic: function() {
            console.log("GetDiagnostic");
            return "";
        },
        GetLastError: function() {
            console.log("GetLastError");
            return "0";
        }                
    };
</script>

This script needs to be on the page that launches the SCORM compliant presentation.

Click here to download a demo presentation (MUST BE LAUNCHED FROM A WEBSERVER / WILL NOT WORK IF LAUNCHED DIRECTLY)

Eclipse CSS Editor

Started searching around for a good CSS editor plugin for Eclipse. I've used Aptana in the past, but was very disappointed. Mostly due to Aptana's intrusive takeover of my Eclipse IDE. I wanted something simple that provided some code highlighting.

Enter Project Amateras. An Eclipse based HTML editor. Has all the usual charactaristics of a good code editor:

  • HTML/CSS/Javascript code assist
  • Code highlighting
  • Code folding

Very nice and FREE plugin.

Internet Explorer 8 Impressions.

I've been using IE8 since it's official release. Microsoft recently started pushing it as a recommended update.

For me the most compelling reason to upgrade is the new interactive Javascript debugger, included in the Developer Toolbar. Anyone who is doing web development understands just how difficult it can be to debug javascript code. A debugger makes it so much easier.

Think Firebug for Internet Explorer.

IE8 includes the Developer Toolbar by default, which can be activated by pressing F12.

The new tools inlude the usual DOM and CSS explorers as well as the new debugger.

The debugger interface is pretty straighforward and should be easily accessible to anyone who has used an interactive debugger.

[More]

URL variables in Flex.

I want to access the URL variables in the URL of the page that launches my Flex application.

The problem:

There is no built-in way to access the querystring or url variables from inside Flex. Any parameters must be passed in as flashvars.

I scoured the web and found this:

How to get URL query-string variables within Flex application

Pretty neat code. Abdul is basically calling the browsers built-in javascript methods for retrieving the URL and querystring values. It doesn't require any additional/custom javascript.

I didn't integrate the class with my code. My needs were simple and could be handled differently within the confines of Flex/Flash.

What this has really done is open my eyes to the ExternalInterface API. The API provides facilities for interacting with the Javascript on the calling page.

If you need easy access to your URL params or just want to see a demo of the ExternalInterface API you should check out Abdul's code.

Javascript Sorting.

Here's a great article on Javascript sorting. It covers creating a custom sorter function.

http://www.breakingpar.com

Extending a Yahoo UI widget.

Recently, I had the need to determine if a YAHOO.widget.TextNode with a specific label existed within a parent node, also an instance of YAHOO.widget.TextNode. I decided to create a custom YAHOO.widget.TextNode by extending the class. This is the first time I've tried to use any OO javascript. I was quite pleased with how easy I could extend any class. Thanks mostly to the excellent documentation provided by Yahoo.

Here's how I did it:

I started by creating node.js to hold my class definition:

I created a custom namespace "JTC.widget"


YAHOO.namespace("JTC.widget");

Create a constructor with the same signature as YAHOO.widget.TextNode and chain the superclass constructor.


YAHOO.JTC.widget.Node = function(oData, oParent, expanded) {
YAHOO.JTC.widget.Node.superclass.constructor.call(this, oData, oParent, expanded);
};

[More]

Javascript Debugging

I just found this really cool tool:

http://addons.mozilla.org/firefox/1843/

It's called FireBug and it's an interactive debugger. It makes debugging javascript a snap!