/******************************************************************************/
/* D'Fusion Web JavaScript Library */
/* */
/* IMPORTANT REMARKS: */
/* - To use this file you have to include javascript_browser_sniffer.js */
/******************************************************************************/
////////////////////////////////////////////////////////////////////////////////
// global variables
// error
var g_tiError = "";
// activate debug
var g_tiDebug = false;
//ID of the ActiveX
var g_tiPluginName = "";
// enable Mac OS X support ?
var g_tiMacOSXEnabled = false;
// disable static version check for Firefox under MacOSX ?
var g_tiDisableStaticVersionDetectionFirefoxMacOSX = false;
// Does the TI logo appear?
var g_tiLogoEnabled = true;
// function used to indicate the plugin need to be update (only used by Firefox under MacOSX)
var g_NeedToUpdateFunc = "tiDFusionPluginNeedToBeUpdated";
////////////////////////////////////////////////////////////////////////////////
// errors strings array
// some error messages
var TI_ERR_NOT_SUPPORTED = "D'Fusion Web is not supported by this operating system or web browser.";
var TI_ERR_EMBED_FAILED = "
Failed to start D'Fusion Web.
";
////////////////////////////////////////////////////////////////////////////////
// Main functions
/*****************************************************************************/
/* tiGenerateDFusionWebHTML: */
/* */
/* Check the operating system, the browser and the plugin version. */
/* If everything is ok HTML is generated to embed the DFusionWeb plugin */
/* into the web page. */
/* With gecko compatible browser is the plugin is not installed or a newer */
/* version is present online instead of embedding the plugin this function */
/* generate HTML code to install the plugin. */
/* */
/* Returns is successful */
/*****************************************************************************/
function tiGenerateDFusionWebHTML(iPluginName, iWidth, iHeight, iPlayerID, iCommandLine,iChooseCameraJSFunc,iActionWhenStartJSFunc, iUseJSToSelectCam, iSplashID)
{
g_tiPluginName = iPluginName;
if (tiOperatingSystemSupported()==false) {
g_tiError = TI_ERR_NOT_SUPPORTED;
return false;
}
if (tiWindowsSupported() && tiInternetExplorer()) {
return tiGenerateDFusionWebHTML_Object(iPluginName, iWidth, iHeight, iPlayerID, iCommandLine,iChooseCameraJSFunc,iActionWhenStartJSFunc, iUseJSToSelectCam, iSplashID);
}
if (tiGecko()) {
if(tiCheckInstallatioNeedForGecko()==false)
{
return tiGenerateDFusionWebHTML_Embed(iPluginName, iWidth, iHeight, iPlayerID, iCommandLine,iChooseCameraJSFunc,iActionWhenStartJSFunc, iUseJSToSelectCam, iSplashID);
} else
{
return true;
}
}
g_tiError = TI_ERR_NOT_SUPPORTED;
return false;
}
////////////////////////////////////////////////////////////////////////////////
// functions specific to Internet Explorer
/*****************************************************************************/
/* tiGenerateDFusionWebHTML_Object: */
/* */
/* Generates the HTMl code to embed the DFusionWeb plugin into */
/* Microsoft Internet Explorer. */
/* */
/* Returns is successful */
/*****************************************************************************/
function tiGenerateDFusionWebHTML_Object(iPluginName, iWidth, iHeight, iPlayerID, iCommandLine,iChooseCameraJSFunc,iActionWhenStartJSFunc, iUseJSToSelectCam, iSplashID)
{
var html = "";
html += "\n";
html += " \n";
html += " \n";
html += " \n";
html += " \n";
html += " \n";
html += " \n";
html += " \n";
if (g_tiLogoEnabled) {
html += " \n";
} else {
html += " \n";
}
//html += TI_ERR_EMBED_FAILED + "\n";
html += "\n";
if (g_tiDebug) {
alert("tiGenerateDFusionWebHTML_Object: \n\n" + html);
}
document.write(html);
return true;
}
function tiInternetExplorer()
{
return is_ie6up;
}
////////////////////////////////////////////////////////////////////////////////
// functions specific to Gecko based web browser (Firefox & co)
/*****************************************************************************/
/* tiGenerateDFusionWebHTML_Embed: */
/* */
/* Generates the HTMl code to embed the DFusionWeb plugin in a gecko */
/* compatible web browser. */
/* */
/* Returns is successful */
/*****************************************************************************/
function tiGenerateDFusionWebHTML_Embed(iPluginName, iWidth, iHeight, iPlayerID, iCommandLine, iChooseCameraJSFunc, iActionWhenStartJSFunc, iUseJSToSelectCam, iSplashID)
{
var html = "";
html += "\n";
html += " \n";
html += " " + TI_ERR_EMBED_FAILED + "\n";
html += " \n";
html += "\n";
if (g_tiDebug) {
alert("tiGenerateDFusionWebHTML_Embed:\n\n" + html);
}
document.write(html);
// force the focus of the plugin
if (document.embeds && document.embeds[g_tiPluginName]) {
document.embeds[g_tiPluginName].focus();
}
return true;
}
/*****************************************************************************/
/* tiGecko: */
/* */
/* Returns true if the current browser is gecko compatible */
/*****************************************************************************/
function tiGecko()
{
return ((is_gecko && tiWindowsSupported()) || tiMacOSXSupported());
}
/*****************************************************************************/
/* tiDFusionPluginForGeckoHere: */
/* */
/* Return non null value if the DFusionWeb plug-in has been loaded. */
/* */
/* It means the DFusionWeb plug-in is present in theplugin directory */
/* (or any alternative directory) of the browser. */
/* */
/* The object return is a plug-in from the navigator.plugins array. */
/*****************************************************************************/
function tiDFusionPluginForGeckoHere()
{
var pluginname = "npdfusionwebfirefox";
if (tiMacOSXSupported()) {
pluginname = "dfusionwebplugin";
}
// here we go through the plug-in loaded by the bowser
// to look for the virtools one.
for(i=0;i
");
if (tiMacOSXSupported()) {
document.write("Click here to download the D'Fusion Web Plug-in setup.
");
} else {
document.write("Click here to download the D'Fusion Web Plug-in setup.
");
}
document.write("You have to manually launch it.
");
document.write("
");
return true;
}
function tiCheckJavascriptCommandForGecko()
{
return (document.embeds && document.embeds[g_tiPluginName] && document.embeds[g_tiPluginName].ExecuteCommand)?true:false;
}
function tiDFusionPluginNeedToBeUpdated(version)
{
}
////////////////////////////////////////////////////////////////////////////////
// utility functions
/*****************************************************************************/
/* tiOperatingSystemSupported: */
/* */
/* Returns true if the operating system is supported. */
/*****************************************************************************/
function tiOperatingSystemSupported()
{
return (tiWindowsSupported() || tiMacOSXSupported());
}
/*****************************************************************************/
/* tiWindowsSupported: */
/* */
/* Returns true if the current version of Microsoft Windows is supported. */
/*****************************************************************************/
function tiWindowsSupported()
{
return is_win32;
}
function tiMacOSXSupported()
{
return g_tiMacOSXEnabled && is_mac && is_macosx && (is_macintel || is_macppc==false);
}
//-- end of file --