Complete JavaScript Source

In order of execution in the startup sequence


/scripts/javascript_test.js


    // This script pulls the "Javascript OK" page into the current frame
    // and starts the Java plug-in test in the next frame

    parent.frm_javascript.location="/status/javascript_ok.html";
    parent.frm_javaplugin.location="/test/javaplugin_test.html";

/scripts/detect_plugin_init.js


    // This script initializes the variables that the VB/IE step will modify.
    // Note that vbscript does not allow variable names to begin with an _.

    var vbie      = 0; // 1 = vbscript supported
    var vbie_java = 0; // 1 = Java plugin detected

/scripts/detect_plugin_vbie.vbs


    'This script performs the MS IE test for the Java Plug-in, if possible.

    on error resume next
    vbie_java     = 0

    'This should check for any version, but installations seem to vary
    vbie_java     = IsObject(CreateObject("JavaSoft.JavaBeansBridge"))

    'Check several versions
    'Note: The "version" here is not directly related to the JRE version
    if not vbie_java then
        for i=1 to 5
            plugin_name = "JavaSoft.JavaBeansBridge." & CStr(i)
            vbie_java  = IsObject(CreateObject(plugin_name))
            if vbie_java then
                exit for
            end if
        next
    end if

    'Convert true/false to 1/0 to match our general convention:
    '1 = OK,    0 = Fail,    -1 = Unknown (this is important for IE on XP)
    if vbie_java then
        vbie_java = 1
    else
        vbie_java = 0
    end if

    ' Flag that we were able to run the MS IE test
    vbie          = 1

/scripts/detect_os.js


    // This script attempts to determine the operating system
    // name from the browser id string.

    // Examples:
    //     Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461) 
    //     Mozilla/4.08 [en] (WinNT; U ;Nav) 
    //     Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1
    //     Mozilla/4.04 [en](X11; U; Irix64 6.4 ip30)

    var _info = navigator.userAgent.toLowerCase()+' [test;]';

    // Look for OS-identifying string
    var _ux  = _info.indexOf ("ux");   // Linux
    var _sun = _info.indexOf ("sun");  // SunOS or Solaris
    var _win = _info.indexOf ("win");  // Windows
    var _ix  = _info.indexOf ("ix");   // General Unix

    var _os_name    = "unknown";
    var _os_version = "unknown";

    if ( _ux >= 0 )
    {
        _os_name = "linux";
    }
    else if ( _sun >= 0 )
    {
        _os_name = "solaris";
    }
    else if ( _win >= 0 )
    {
        _os_name = "windows";
    }
    else if ( _ix >= 0 )
    {
        _os_name = "unix";
    }

/scripts/detect_plugin.js


    // This script attempts to determine whether the Java Plug-In is already
    // installed and enabled in the browser, and whether it supports version 1.3.1.

    var _plugin_installed  = -1;            // 1=true, 0=false, -1=unknown
    var _plugin_enabled    = -1;            // 1=true, 0=false, -1=unknown
    var _plugin_version131 = -1;            // 1=true, 0=false, -1=unknown

    if ( vbie > 0 )                        // If vbscript is supported, it must be IE
    {                                      // Detect installation only; en/disabled and version unknown
        if ( vbie_java )
        {
            _plugin_installed = 1;
        }
        else
        {
            _plugin_installed = -1;        // Never assume failed for IE, it's too easy to get a false negative
        }
    }
    else                                   // Otherwise assume has Netscape-style javascript
    {                                      // (if something here fails, then we don't know)
        // Load any "fresh" plugins
        navigator.plugins.refresh (false);

        // Try the expected MIME type names, in order of decreasing version/specificity
        var _jpi_subversion = null;
        var appletType   = null;
        for (i=20; i>0; i--)
        {
            _jpi_subversion = '  0'+i;
            _jpi_subversion = _jpi_subversion.slice (_jpi_subversion.length-2);
            //document.writeln ('trying "application/x-java-applet;jpi-version=1.3.1_'+_jpi_subversion+'"<br>');
            appletType   = navigator.mimeTypes["application/x-java-applet;jpi-version=1.3.1_"+_jpi_subversion];
            if ( appletType != null )
            {
                break;
            }
        }
        if ( appletType == null )
        {
            //document.writeln ('trying "application/x-java-applet;jpi-version=1.3.1"<br>');
            appletType   = navigator.mimeTypes["application/x-java-applet;version=1.3.1"];
        }
        if ( appletType == null )
        {
            //document.writeln ('trying "application/x-java-applet;version=1.3.1"<br>');
            appletType   = navigator.mimeTypes["application/x-java-applet;version=1.3.1"];
        }
        if ( appletType == null )
        {
            //document.writeln ('trying "application/x-java-applet;version=1.3"<br>');
            appletType   = navigator.mimeTypes["application/x-java-applet;version=1.3"];
        }
        if ( appletType == null )
        {
            //document.writeln ('trying "application/x-java-applet"<br>');
            appletType   = navigator.mimeTypes["application/x-java-applet"];
        }

        if ( appletType == null )          // MIME type isn't even supported
        {
            _plugin_installed  = 0;
            _plugin_enabled    = 0;
            _plugin_version131 = 0;
        }
        else                               // MIME type supported, check for enabled
        {
            var appletPlugin = appletType.enabledPlugin;

            if ( appletPlugin == null )    // Not enabled, double-check for installed and version
            {
                _plugin_enabled = 0;

                // Loop over all installed plugins, looking for the Java Plug-In
                // and suitable version
                for (i=0; i<navigator.plugins.length; i++)
                {
                    if (  (navigator.plugins[i].name.toLowerCase().indexOf("java plug-in") >= 0)
                       || (navigator.plugins[i].description.toLowerCase().indexOf("java plug-in") >= 0) )
                    {
                        for (j=0; j<navigator.plugins[i].length; j++)
                        {
                            if ( navigator.plugins[i][j].type.toLowerCase().indexOf
                                 ("application/x-java-applet") >= 0 )
                            {
                                _plugin_installed = 1;
                                if ( navigator.plugins[i][j].type.toLowerCase().indexOf
                                     ("version=1.3.1") >= 0 )
                                {
                                    _plugin_version131 = 1;
                                }
                            }
                        }
                    }
                    if ( _plugin_installed > 0 )
                    {
                        break;
                    }
                }
                if ( _plugin_installed <= 0 )
                {
                    _plugin_installed = 0;
                }
                if ( _plugin_version131 <= 0 )
                {
                    _plugin_version131 = 0;
                }
            }
            else                           // Installed and enabled, double-check version
            {
                _plugin_installed  = 1;
                _plugin_enabled    = 1;

                for (j=0; j<appletPlugin.length; j++)
                {
                    if ( appletPlugin[j].type.toLowerCase().indexOf
                         ("application/x-java-applet") >= 0 )
                    {
                        if ( appletPlugin[j].type.toLowerCase().indexOf
                             ("version=1.3.1") >= 0 )
                        {
                            _plugin_version131 = 1;
                            break;
                        }
                    }
                }

                if ( !navigator.javaEnabled() )
                {
                    _plugin_enabled = 0;
                }
            }
        }
    }

/scripts/javaplugin_test.js


    // This script handles the plugin status:
    // Generate status, suggestion message, why?, and help in the "frm_javaplugin" frame.
    // Iff all requirements (installation, enablement, and version) are all either
    // OK or unknown, pull "testing" into the "frm_applets" frame and try to launch the iProject.

    // This script relies on some values set in other scripts:
    //     _os_name              set in     detect_os.js
    //     _plugin_installed       "        detect_plugin.js    1=true, 0=false, -1=unknown
    //     _plugin_enabled         "          "                   "
    //     _plugin_version131      "          "                   "

    // "Frm_javaplugin" settings
    var _jpi_display      = 'unknown';
    var _jpi_status       = 'Java Plug-In Unknown';
    var _jpi_message      = 'If the applet test stalls or fails, '
                          + 'please ensure that the Java Plug-In is properly '
                          + '<a target=_blank href="/support/javaplugin.html">installed</a> '
                          + 'on your system.';
    var _jpi_help         = 'install';
    var _jpi_status_font  = 0;
    var _jpi_message_font = -1;

    // Determine the status display class
    if (  (_plugin_installed  == 0)
       || (_plugin_enabled    == 0)
       || (_plugin_version131 == 0) )
    {
        _jpi_display = 'fail';
    }
    else if (  (_plugin_installed  < 0)
            || (_plugin_enabled    < 0)
            || (_plugin_version131 < 0) )
    {
        _jpi_display = 'unknown';
    }
    else
    {
        _jpi_display = 'ok';
    }

    // Generate the status and message
    // These have to fit in a limited cell area (64 pixels high),
    // so use font sizing if we generate a long string
    if (  (_plugin_installed  > 0)         // All OK
       && (_plugin_enabled    > 0)
       && (_plugin_version131 > 0) )
    {
        _jpi_status       = 'Java Plug-In OK';
        _jpi_message      = 'The iProject requires the Java Plug-In.';
        _jpi_message_font = 0;
    }
    else if ( _plugin_installed <= 0 )     // (Maybe?) not installed
    {
        if ( _plugin_installed == 0 )
        {
            _jpi_status      = 'Java Plug-In Not Installed';
            _jpi_status_font = -1;
        }
        else
        {
            _jpi_status      = 'Java Plug-In May Not Be Installed';
            _jpi_status_font = -1;
        }

        if (  (_os_name == "linux")
           || (_os_name == "solaris")
           || (_os_name == "windows") )
        {
            _jpi_message = 'Please ensure that the Java Plug-In is properly '
                         + '<a target=_blank href="/support/javaplugin_'+_os_name+'.html">installed</a> '
                         + 'on your system.';
        }
        else
        {
            _jpi_message = 'Please ensure that the Java Plug-In is properly '
                         + '<a target=_blank href="/support/javaplugin.html">installed</a> '
                         + 'on your system.';
        }
        _jpi_message_font = 0;
        if ( _plugin_installed < 0 )
        {
            _jpi_message      = 'If the applet test stalls or fails, '
                              + _jpi_message;
            _jpi_message_font = -1;
        }
    }
    else if ( _plugin_enabled <= 0 )       // (Maybe?) not enabled
    {
        if ( _plugin_enabled == 0 )
        {
            _jpi_status = 'Java Plug-In Disabled';
        }
        else
        {
            _jpi_status      = 'Java Plug-In May Not Be Enabled';
            _jpi_status_font = -1;
        }

        _jpi_message = 'Please ensure that the Java Plug-In is '
                     + '<a target=_blank href="/support/javaplugin_help.html#enabled">enabled</a> '
                     + 'on your system.';
        _jpi_message_font = 0;
        if ( _plugin_enabled < 0 )
        {
            _jpi_message      = 'If the applet test stalls or fails, '
                              + _jpi_message;
            _jpi_message_font = -1;
        }
    }
    else                                   // (Maybe?) old version (need 1.3.1 or later for new Verisign CA certificate)
    {
        if ( _plugin_version131 == 0 )
        {
            _jpi_status = 'Java Plug-In Too Old';
        }
        else
        {
            _jpi_status      = 'Java Plug-In May Be Too Old';
            _jpi_status_font = -1;
        }

        _jpi_message = 'Please ensure that you have the '
                     + '<a target=_blank href="/support/javaplugin_help.html#version">Java Plug-In version 1.3.1 or later</a> '
                     + 'on your system.';
        _jpi_message_font = 0;
        if ( _plugin_version131 < 0 )
        {
            _jpi_message      = 'If the applet test stalls or fails, '
                              + _jpi_message;
            _jpi_message_font = -1;
        }
    }

    // Adjust font sizes, if needed
    if ( _jpi_status_font != 0 )
    {
        _jpi_status = '<font size='+_jpi_status_font+'>'+_jpi_status+'</font>';
    }
    if ( _jpi_message_font != 0 )
    {
        _jpi_message = '<font size='+_jpi_message_font+'>'+_jpi_message+'</font>';
    }

    // Determine the help section
    if ( _plugin_installed <= 0 )
    {
        _jpi_help = 'installed';
    }
    else if ( _plugin_enabled <= 0 )
    {
        _jpi_help = 'enabled';
    }
    else if ( _plugin_version131 <= 0 )
    {
        _jpi_help = 'version';
    }

    // Generate the plug-in test result HTML
    document.writeln ('<center>');
    document.writeln ('<table cellspacing=4 width="90%">');
    document.writeln ('<tr>');

    // Status column
    document.writeln ('<td width="28%"><b class='+_jpi_display+'>'+_jpi_status+'</b></td>');

    // Message column
    document.writeln ('<td width="56%">'+_jpi_message+'</td>');

    // Why? column (constant)
    document.writeln ('<td width=60><a target=_blank href="/support/why.html#javaplugin"><b class=why>Why?</b></a></td>');

    // Help column
    if ( _jpi_help == null )
    {
        document.writeln ('<td width=60><a target=_blank href="/support/javaplugin_help.html"><b class=help>Help</b></a></td>');
    }
    else
    {
        document.writeln ('<td width=60><a target=_blank href="/support/javaplugin_help.html#"'+_jpi_help+'><b class=help>Help</b></a></td>');
    }

    // Close the HTML
    document.writeln ('</tr>');
    document.writeln ('</table>');
    document.writeln ('</center>');

    // If all requirements are either OK or unknown, give the launch a try
    if (  ( (_plugin_installed  > 0) || (_plugin_installed  < 0) )
       && ( (_plugin_enabled    > 0) || (_plugin_enabled    < 0) )
       && ( (_plugin_version131 > 0) || (_plugin_version131 < 0) ) )
    {
        parent.frm_applets.location="/test/applets_test.html";
        parent.frm_welcome.location="/launch/iproject_launch.html";
    }

/scripts/connection_info.js


    // Set variables with info on connecting to the iProject server
    // This script is the last one called before launching the client,
    // so any settings here will override the defaults.
    // This file is also not overwritten by the iProject install/update wizard, 
    // so it can be used to hold localized settings that will automatically endure
    // across versions.

    var _server    = "";
    var _port_list = "";

/scripts/client_parameters.js


    // These parameters are used to write out the browser-specific tags to launch applets

    var _code          = "IProjectLaunch";
    var _startup       = "Plugin Tag Sign Port Top";
    var _width         = "270";
    var _height        = "80";
    var _codebase      = ".";
    var _pluginspage   = "/support/javaplugin.html";
    var _archive       = "/bin/irclaunch.jar";
    var _type          = "application/x-java-applet;version=1.3";
    var _scriptable    = "false";
    var _cache_option  = "PLUGIN";
    var _cache_archive = "/bin/irclaunch.jar, /bin/ircclient3.jar, /bin/irclocales.jar, /bin/jcert.jar, /bin/jnet.jar, /bin/jsse.jar";
    var _cache_version = "1.9.9.0, 1.9.9.0, 1.9.9.0, 1.0.2.5, 1.0.2.5, 1.0.2.5";
    var _bug_track     = "http://www.ireservoir.net/cgi-bin/ttcgi.exe?command=SoloSubmitScreen&databaseid=1";

/scripts/detect_launch.js


    // Determine how to launch a signed applet from the current browser

    // Examples:
    //     Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461) 
    //     Mozilla/4.08 [en] (WinNT; U ;Nav) 
    //     Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1
    //     Mozilla/4.04 [en](X11; U; Irix64 6.4 ip30)

    var _info = navigator.userAgent.toLowerCase()+' [test;]';

    // Get Mozilla version, if any
    var _moz_vers = "unknown";
    var _moz_dex  = _info.indexOf ("mozilla/");
    var _moz_end  = Math.min (_info.indexOf ("("), _info.indexOf ("["));
    if ( (0 <= _moz_dex) && (_moz_dex+8 < _moz_end) )
    {
        _moz_vers = _info.substring (_moz_dex+8, _moz_end);
    }

    // Look for browser-identifying string
    var _nav  = _info.indexOf("nav");       // Note - unreliable
    var _net  = _info.indexOf("netscape");
    var _msie = _info.indexOf("msie");

    var _brs_vers  = "unknown";
    if ( _net >= 0 )
    {
        // Netscape - Look for newer Netscape version
        var _slash = _info.indexOf ("/", _net);
        var _space = _info.indexOf (" ", _slash+1);
        if ( (0 <= _slash) && (_slash+1 < _space) )
        {
            _brs_vers = _info.substring (_slash+1, _space);
        }
        else
        {
            // Older Netscape - default to Mozilla version
            _brs_vers = _moz_vers;
        }
    }
    else if ( _msie >= 0 )
    {
        // IE - look for version (no default)
        var _space1 = _info.indexOf (" ", _msie);
        var _space2 = Math.min (_info.indexOf(" ", _space1+1), _info.indexOf(";", _space1+1));
        if ( (0 <= _space1) && (_space1+1 < _space2) )
        {
            _brs_vers = _info.substring (_space1+1, _space2);
        }
    }
    else if ( _moz_dex >= 0 )
    {
        // General Mozilla - use Mozilla version
        _nav      = 1023;
        _brs_vers = _moz_vers;
    }

    // Look for OS-identifying string
    var _ix  = _info.indexOf ("ix");   // General Unix
    var _sun = _info.indexOf ("sun");  // SunOS or Solaris
    var _ux  = _info.indexOf ("ux");   // Linux
    var _win = _info.indexOf ("win");  // Windows

    // By default, do not launch or cache
    var _applet = false;
    var _embed  = false;
    var _object = false;
    var _cache  = false;

    if ( (_msie >= 0) && (_win >= 0) )
    {
        // IE on Windows - Use Object tag
        _object = true;

        // Versions before 5 do not support jar caching
        var _ie_vers = parseFloat (_brs_vers);
        _cache  = ( !isNaN(_ie_vers) && (_ie_vers >= 5) );
    }
    else if (  ( (_nav >= 0) || (_net >= 0) )
            && ( (_win >= 0) || (_ix  >= 0) || (_sun >= 0) || (_ux >= 0) ) )
    {
        // Netscape on Windows or Unix - Use Embed tag, caching works
        _embed = true;
        _cache = true;
    }
    else
    {
        // ??? (e.g. Opera) - Try Applet and caching
        _applet = true;
        _cache  = true;
    }

    _info = navigator.userAgent;

/scripts/launch.js


    // This script writes out the browser-specific tags to 
    // launch the iProject client applet.

    // This script relies on a few external variables:
    //     _width           Set in client_parameters.js
    //     _height            "
    //     _startup           "
    //     _code              "
    //     _codebase          "
    //     _pluginspage       "
    //     _archive           "
    //     _type              "
    //     _scriptable        "
    //     _cache_option      "
    //     _cache_archive     "
    //     _cache_version     "
    //     _bug_track         "
    //     _server          Set in connection_info.js
    //     _port_list         "
    //     _object          Set in detect_launch.js
    //     _embed             "
    //     _applet            "
    //     _cache             "

    //Use detected browser type to write launch tags

    if ( _object == true ) 
    {   // Originally IE-specific, now HTML 4 standard
        document.writeln ('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ');
        document.writeln ('WIDTH       = "'+_width+'" ');
        document.writeln ('HEIGHT      = "'+_height+'" ');
        document.writeln ('pluginspage = "'+_pluginspage+'" ');
        document.writeln ('codebase    = "'+_codebase+'"> ');
        document.writeln ('<PARAM NAME = CODE          VALUE = "'+_code+'" >');
        document.writeln ('<PARAM NAME = CODEBASE      VALUE = "'+_codebase+'" >');
        document.writeln ('<PARAM NAME = ARCHIVE       VALUE = "'+_archive+'">');
        document.writeln ('<PARAM NAME = "type"        VALUE = "'+_type+'">');
        document.writeln ('<PARAM NAME = "scriptable"  VALUE = "'+_scriptable+'">');
        document.writeln ('<PARAM NAME = "pluginspage" VALUE = "'+_pluginspage+'">');
        document.writeln ('<PARAM NAME = "Server"      VALUE = "'+_server+'">');
        document.writeln ('<PARAM NAME = "Startup"     VALUE = "'+_startup+'">');
        document.writeln ('<PARAM NAME = "Port"        VALUE = "'+_port_list+'">');
        document.writeln ('<PARAM NAME = "BugTrack"    VALUE = "'+_bug_track+'">');
        document.writeln ('<PARAM NAME = "Loader"      VALUE = "Object">');
        if ( _cache == true )
        {
            document.writeln ('<PARAM NAME = "cache_option"   VALUE = "'+_cache_option+'">');
            document.writeln ('<PARAM NAME = "cache_archive"  VALUE = "'+_cache_archive+'">');
            document.writeln ('<PARAM NAME = "cache_version"  VALUE = "'+_cache_version+'">');
        }
        document.writeln ('<script language="JavaScript" src="/scripts/applets_fail.js"></script>');
        document.writeln('</OBJECT>');
    }
    else if ( _embed == true )
    {   // Netscape-specific (for older versions)
        document.writeln('<EMBED type = "'+_type+'" ');
        document.writeln('CODE        = "'+_code+'" ');
        document.writeln('CODEBASE    = "'+_codebase+'" ');
        document.writeln('ARCHIVE     = "'+_archive+'" ');
        document.writeln('WIDTH       = "'+_width+'" ');
        document.writeln('HEIGHT      = "'+_height+'" ');
        document.writeln('Server      =  "'+_server+'" ');
        document.writeln('Port        =  "'+_port_list+'" ');
        document.writeln('BugTrack    =  "'+_bug_track+'" ');
        document.writeln('scriptable  = '+_scriptable+' ');
        if ( _cache == true )
        {
            document.writeln ('cache_option  = "'+_cache_option+'" ');
            document.writeln ('cache_archive = "'+_cache_archive+'" ');
            document.writeln ('cache_version = "'+_cache_version+'" ');
        }
        document.writeln('pluginspage = "'+_pluginspage+'" ');
        document.writeln ('Startup    = "'+_startup+'" ');
        document.writeln('Loader      = "Embed"> ');
        document.writeln('</EMBED>');
        document.writeln ('<noembed><script language="JavaScript" src="/scripts/applets_fail.js"></script></noembed>');
    }
    else if ( _applet == true )
    {   // Generic applet (can cause conflicts with Microsoft VM)
        document.writeln ('<APPLET CODE = "'+_code+'" ');
        document.writeln ('CODEBASE     = "'+_codebase+'" ');
        document.writeln ('ARCHIVE      = "'+_archive+'" ');
        document.writeln ('WIDTH        = "'+_width+'" ');
        document.writeln ('HEIGHT       = "'+_height+'" ');
        document.writeln ('pluginspage  = "'+_pluginspage+'"> ');
        document.writeln ('<PARAM NAME  = CODE          VALUE = "'+_code+'" >');
        document.writeln ('<PARAM NAME  = CODEBASE      VALUE = "'+_codebase+'" >');
        document.writeln ('<PARAM NAME  = ARCHIVE       VALUE = "'+_archive+'">');
        document.writeln ('<PARAM NAME  = "type"        VALUE = "'+_type+'">');
        document.writeln ('<PARAM NAME  = "scriptable"  VALUE = "'+_scriptable+'">');
        document.writeln ('<PARAM NAME  = "pluginspage" VALUE = "'+_pluginspage+'">');
        document.writeln ('<PARAM NAME  = "Server"      VALUE = "'+_server+'">');
        document.writeln ('<PARAM NAME  = "Startup"     VALUE = "'+_startup+'">');
        document.writeln ('<PARAM NAME  = "Port"        VALUE = "'+_port_list+'">');
        document.writeln ('<PARAM NAME  = "BugTrack"    VALUE = "'+_bug_track+'">');
        document.writeln ('<PARAM NAME  = "Loader"      VALUE = "Applet">');
        if ( _cache == true )
        {
            document.writeln ('<PARAM NAME = "cache_option"   VALUE = "'+_cache_option+'">');
            document.writeln ('<PARAM NAME = "cache_archive"  VALUE = "'+_cache_archive+'">');
            document.writeln ('<PARAM NAME = "cache_version"  VALUE = "'+_cache_version+'">');
        }
        document.writeln ('<script language="JavaScript" src="/scripts/applets_fail.js"></script>');
        document.writeln ('</APPLET>');
    }
    else
    {   // Unknown browser
        parent.frm_applets.location="/status/applets_fail.html";
    }

/scripts/applets_fail.js


    // This script pulls the "Applets failed" page into the appropriate frame

    parent.frm_applets.location="/status/applets_fail.html";