home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 January / Gamestar_80_2006-01_dvd.iso / Utility / 5-11_xp-2k_dd_ccc_wdm_enu_27345.exe / Data1.cab / _35D18EE8432F40789305236B3ED5A123 < prev    next >
Text File  |  2003-09-15  |  7KB  |  271 lines

  1. // Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHJava_Object()
  5. {
  6.   this.mSettings = new WWHJavaSettings_Object();
  7.  
  8.   this.fInit           = WWHJava_Init;
  9.   this.fUseAppletInfo  = WWHJava_UseAppletInfo;
  10.   this.fGetAppletURL   = WWHJava_GetAppletURL;
  11.   this.fAppletLoaded   = WWHJava_AppletLoaded;
  12.   this.fAppletUnloaded = WWHJava_AppletUnloaded;
  13.   this.fGetPlatform    = WWHJava_GetPlatform;
  14.   this.fGetBrowser     = WWHJava_GetBrowser;
  15.   this.fSetDocument    = WWHJava_SetDocument;
  16.   this.fCookiesEnabled = WWHJava_CookiesEnabled;
  17.   this.fSetFavorites   = WWHJava_SetFavorites;
  18.   this.fGetFavorites   = WWHJava_GetFavorites;
  19. }
  20.  
  21. function  WWHJava_Init()
  22. {
  23.   // Netscape 4.x should work if enabled
  24.   //
  25.   if ((WWHFrame.WWHBrowser.mBrowser == 1) &&  // Shorthand for Netscape
  26.       (WWHFrame.WWHBrowser.mbJavaEnabled) &&
  27.       (WWHFrame.WWHBrowser.mbJavaEnabled))
  28.   {
  29.     // Load the applet
  30.     //
  31.     this.fUseAppletInfo("netscape.security.AppletSecurity");
  32.   }
  33.   else
  34.   {
  35.     // Load the test applet
  36.     //
  37.     WWHFrame.WWHHelp.fReplaceLocation("WWHNavigationFrame", WWHFrame.WWHBrowser.fRestoreEscapedSpaces(WWHFrame.WWHHelp.mBaseURL + "wwhelp/wwhimpl/java/html/javainfo.htm"));
  38.   }
  39.  
  40.   return 0;
  41. }
  42.  
  43. function  WWHJava_UseAppletInfo(ParamSecurityManager)
  44. {
  45.   var  bVarContinue;
  46.   var  RedirectURL;
  47.   var  Parts;
  48.   var  VarImplementationCookie;
  49.  
  50.  
  51.   bVarContinue = false;
  52.   if (ParamSecurityManager.length > 0)
  53.   {
  54.     bVarContinue = true;
  55.  
  56.     // UNCs do not work under the Sun JVM on Windows
  57.     //
  58.     if (WWHFrame.WWHBrowser.mPlatform == 1)  // Shorthand for Windows
  59.     {
  60.       if (ParamSecurityManager == "sun.plugin.ActivatorSecurityManager")
  61.       {
  62.         if (WWHFrame.WWHHelp.mLocationURL.indexOf("file://///") == 0)
  63.         {
  64.           bVarContinue = false;
  65.         }
  66.       }
  67.     }
  68.   }
  69.  
  70.   if (bVarContinue)
  71.   {
  72.     // Load applet
  73.     //
  74.     WWHFrame.WWHHelp.fReplaceLocation("WWHNavigationFrame", WWHFrame.WWHBrowser.fRestoreEscapedSpaces(this.fGetAppletURL(ParamSecurityManager)));
  75.  
  76.     // Load rest of help system
  77.     //
  78.     WWHFrame.WWHHelp.fInitStage(0);
  79.   }
  80.   else
  81.   {
  82.     // Java not available or LiveConnect failed, redirect to JavaScript
  83.     //
  84.     RedirectURL = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/wwhelp.htm";
  85.  
  86.     // Keep any URL parameters specified
  87.     //
  88.     if (WWHFrame.WWHHelp.mLocationURL.indexOf("?") != -1)
  89.     {
  90.       Parts = WWHFrame.WWHHelp.mLocationURL.split("?");
  91.       RedirectURL += "?" + Parts[1];
  92.     }
  93.  
  94.     // Reset implementation cookie
  95.     //
  96.     VarImplementationCookie = "WWH" + WWHFrame.WWHHelp.mSettings.mCookiesID + "_Impl";
  97.     WWHFrame.WWHBrowser.fSetCookie(VarImplementationCookie, "javascript", WWHFrame.WWHHelp.mSettings.mCookiesDaysToExpire);
  98.  
  99.     // Redirect
  100.     //
  101.     WWHFrame.WWHHelp.fReplaceLocation("WWHFrame", RedirectURL);
  102.   }
  103. }
  104.  
  105. function  WWHJava_GetAppletURL(ParamSecurityManager)
  106. {
  107.   var  AppletURL = "";
  108.  
  109.  
  110. // HACK BEN
  111. // Do something with ParamSecurityManager
  112.   // Pick which Java applet based on platform/browser info
  113.   //
  114.   if (WWHFrame.WWHBrowser.mBrowser == 1)  // Shorthand for Netscape
  115.   {
  116.     AppletURL = "wwhelp/wwhimpl/java/html/netscape.htm";
  117.   }
  118.   else if ((WWHFrame.WWHBrowser.mBrowser == 4) ||  // Shorthand for Netscape 6.x (Mozilla)
  119.            (WWHFrame.WWHBrowser.mBrowser == 5))    // Shorthand for Safari
  120.   {
  121.     if (WWHFrame.WWHBrowser.mPlatform == 0)  // Shorthand for Unknown (likely Unix)
  122.     {
  123.       AppletURL = "wwhelp/wwhimpl/java/html/mozillau.htm";
  124.     }
  125.     else
  126.     {
  127.       AppletURL = "wwhelp/wwhimpl/java/html/mozilla.htm";
  128.     }
  129.   }
  130.   else  // Assume IE
  131.   {
  132.     if (WWHFrame.WWHBrowser.mbWindowsIE60)
  133.     {
  134.       AppletURL = "wwhelp/wwhimpl/java/html/explore6.htm";
  135.     }
  136.     else
  137.     {
  138.       AppletURL = "wwhelp/wwhimpl/java/html/explorer.htm";
  139.     }
  140.   }
  141.  
  142.   // Prefix location
  143.   //
  144.   AppletURL = WWHFrame.WWHHelp.mBaseURL + AppletURL;
  145.  
  146.   return AppletURL;
  147. }
  148.  
  149. function  WWHJava_AppletLoaded()
  150. {
  151.   var  RedirectURL;
  152.   var  Parts;
  153.   var  VarNavigationFrame;
  154.  
  155.  
  156.   if ( ! WWHFrame.WWHHandler.mbInitialized)
  157.   {
  158.     if (WWHFrame.WWHHelp.mInitStage == 0)
  159.     {
  160.       // User hit back button after using the applet, reload everything
  161.       //
  162.       RedirectURL = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/java/html/wwhelp.htm";
  163.  
  164.       // Keep any URL parameters specified
  165.       //
  166.       if (WWHFrame.WWHHelp.mLocationURL.indexOf("?") != -1)
  167.       {
  168.         Parts = WWHFrame.WWHHelp.mLocationURL.split("?");
  169.         RedirectURL += "?" + Parts[1];
  170.       }
  171.  
  172.       // Redirect
  173.       //
  174.       WWHFrame.WWHHelp.fReplaceLocation("WWHFrame", RedirectURL);
  175.     }
  176.     else
  177.     {
  178.       // Indicate that handler was initialized
  179.       //
  180.       WWHFrame.WWHHandler.mbInitialized = true;
  181.  
  182.       // Initialize applet size if necessary
  183.       //
  184.       VarNavigationFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHNavigationFrame"));
  185.       if (typeof(VarNavigationFrame.WWHNavigationFrame_InitSize) == "function")
  186.       {
  187.         setTimeout(WWHFrame.WWHHelp.fGetFrameReference("WWHNavigationFrame") + ".WWHNavigationFrame_InitSize();", 1);
  188.       }
  189.  
  190.       // Complete initialization
  191.       //
  192.       WWHFrame.WWHHelp.fHandlerInitialized();
  193.     }
  194.   }
  195. }
  196.  
  197. function  WWHJava_AppletUnloaded()
  198. {
  199.   if (WWHFrame.WWHBrowser.mBrowser != 1)  // Shorthand for Netscape
  200.   {
  201.     WWHFrame.WWHHandler.mbInitialized = false;
  202.   }
  203.  
  204.   return 0;
  205. }
  206.  
  207. function  WWHJava_GetPlatform()
  208. {
  209.   return WWHFrame.WWHBrowser.mPlatform;
  210. }
  211.  
  212. function  WWHJava_GetBrowser()
  213. {
  214.   return WWHFrame.WWHBrowser.mBrowser;
  215. }
  216.  
  217. function  WWHJava_SetDocument(ParamBookIndex,
  218.                               ParamFileIndex,
  219.                               ParamAnchor)
  220. {
  221.   var  VarBookIndex;
  222.   var  VarFileIndex;
  223.   var  VarAnchor;
  224.   var  VarURL;
  225.  
  226.  
  227.   // Insure parameters get converted to the expected types
  228.   //
  229.   VarBookIndex = parseInt(ParamBookIndex);
  230.   VarFileIndex = parseInt(ParamFileIndex);
  231.   VarAnchor    = "" + ParamAnchor;
  232.  
  233.   // Construct a URL for the requested document
  234.   //
  235.   VarURL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(VarBookIndex, VarFileIndex, VarAnchor);
  236.  
  237.   // Display the document
  238.   //
  239.   WWHFrame.WWHHelp.fSetDocumentHREF(VarURL, false);
  240. }
  241.  
  242. function  WWHJava_CookiesEnabled()
  243. {
  244.   return WWHFrame.WWHHelp.fCookiesEnabled();
  245. }
  246.  
  247. function  WWHJava_SetFavorites(ParamFavorites)
  248. {
  249.   if (this.fCookiesEnabled())
  250.   {
  251.     WWHFrame.WWHBrowser.fSetCookie(WWHFrame.WWHHelp.mFavoritesCookie, ParamFavorites, WWHFrame.WWHHelp.mSettings.mCookiesDaysToExpire);
  252.   }
  253. }
  254.  
  255. function  WWHJava_GetFavorites()
  256. {
  257.   var  VarFavorites = "";
  258.  
  259.  
  260.   if (this.fCookiesEnabled())
  261.   {
  262.     VarFavorites = WWHFrame.WWHBrowser.fGetCookie(WWHFrame.WWHHelp.mFavoritesCookie);
  263.     if (VarFavorites == null)
  264.     {
  265.       VarFavorites = "";
  266.     }
  267.   }
  268.  
  269.   return VarFavorites;
  270. }
  271.