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 / _B83CD7F09BDD4285847C78B18CC84C19 < prev    next >
Text File  |  2003-09-15  |  14KB  |  533 lines

  1. // Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHPanelsEntry_Object(ParamPanelObject)
  5. {
  6.   this.mbShowInitMessage = true;
  7.   this.mPanelObject      = ParamPanelObject;
  8.   this.mScrollPosition   = new Array(0, 0);
  9. }
  10.  
  11. function  WWHPanels_Object()
  12. {
  13.   this.mCurrentPanel = 0;
  14.   this.mPanelEntries = new Array();
  15.   this.mPopup        = new WWHPopup_Object("WWHFrame.WWHJavaScript.mPanels.mPopup",
  16.                                            "REPLACE ME",
  17.                                            WWHPanelHoverText_Translate, WWHPanelHoverText_Format,
  18.                                            "WWHPanelPopupDIV", "WWHPanelPopupText", 1000, 12, 20,
  19.                                            WWHFrame.WWHJavaScript.mSettings.mHoverText.mWidth);
  20.   this.mbChangingPanels       = false;
  21.   this.mbLoading              = false;
  22.   this.mbReloadOnlyNavigation = false;
  23.  
  24.   this.fGetCurrentPanelEntry  = WWHPanels_GetCurrentPanelEntry;
  25.   this.fGetCurrentPanelObject = WWHPanels_GetCurrentPanelObject;
  26.   this.fInitHeadHTML          = WWHPanels_InitHeadHTML;
  27.   this.fInitBodyHTML          = WWHPanels_InitBodyHTML;
  28.   this.fInitLoaded            = WWHPanels_InitLoaded;
  29.   this.fPopupHTML             = WWHPanels_PopupHTML;
  30.   this.fClearScrollPosition   = WWHPanels_ClearScrollPosition;
  31.   this.fSaveScrollPosition    = WWHPanels_SaveScrollPosition;
  32.   this.fRestoreScrollPosition = WWHPanels_RestoreScrollPosition;
  33.   this.fJumpToAnchor          = WWHPanels_JumpToAnchor;
  34.   this.fChangePanel           = WWHPanels_ChangePanel;
  35.   this.fReloadPanel           = WWHPanels_ReloadPanel;
  36.   this.fReloadNavigation      = WWHPanels_ReloadNavigation;
  37.   this.fReloadView            = WWHPanels_ReloadView;
  38.   this.fPanelNavigationLoaded = WWHPanels_PanelNavigationLoaded;
  39.   this.fPanelViewLoaded       = WWHPanels_PanelViewLoaded;
  40.  
  41.   // Add visible panels
  42.   //
  43.   if (WWHFrame.WWHJavaScript.mSettings.mTOC.mbShow)
  44.   {
  45.     WWHFrame.WWHOutline.mPanelTabIndex = this.mPanelEntries.length;
  46.     this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHOutline);
  47.   }
  48.   if (WWHFrame.WWHJavaScript.mSettings.mIndex.mbShow)
  49.   {
  50.     WWHFrame.WWHIndex.mPanelTabIndex = this.mPanelEntries.length;
  51.     this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHIndex);
  52.   }
  53.   if (WWHFrame.WWHJavaScript.mSettings.mSearch.mbShow)
  54.   {
  55.     WWHFrame.WWHSearch.mPanelTabIndex = this.mPanelEntries.length;
  56.     this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHSearch);
  57.   }
  58. }
  59.  
  60. function  WWHPanels_GetCurrentPanelEntry()
  61. {
  62.   return this.mPanelEntries[this.mCurrentPanel];
  63. }
  64.  
  65. function  WWHPanels_GetCurrentPanelObject()
  66. {
  67.   return this.mPanelEntries[this.mCurrentPanel].mPanelObject;
  68. }
  69.  
  70. function  WWHPanels_InitHeadHTML()
  71. {
  72.   var  HTML = "";
  73.   var  PanelEntry;
  74.  
  75.  
  76.   if (WWHFrame.WWHHelp.mInitStage > 0)
  77.   {
  78.     // Access panel entry
  79.     //
  80.     PanelEntry = this.fGetCurrentPanelEntry();
  81.  
  82.     if (PanelEntry.mbShowInitMessage)
  83.     {
  84.       // Nothing to do
  85.       //
  86.     }
  87.     else
  88.     {
  89.       HTML = PanelEntry.mPanelObject.fInitHeadHTML();
  90.     }
  91.   }
  92.  
  93.   return HTML;
  94. }
  95.  
  96. function  WWHPanels_InitBodyHTML()
  97. {
  98.   var  HTML = "";
  99.   var  PanelEntry;
  100.  
  101.  
  102.   if (WWHFrame.WWHHelp.mInitStage > 0)
  103.   {
  104.     // Access panel entry
  105.     //
  106.     PanelEntry = this.fGetCurrentPanelEntry();
  107.  
  108.     if (PanelEntry.mbShowInitMessage)
  109.     {
  110.       // Display initializing message
  111.       //
  112.       HTML = "<h2>" + WWHFrame.WWHJavaScript.mMessages.mInitializingMessage + "</h2>\n";
  113.  
  114.       // Only show message once
  115.       //
  116.       PanelEntry.mbShowInitMessage = false;
  117.     }
  118.     else
  119.     {
  120.       HTML = PanelEntry.mPanelObject.fInitBodyHTML();
  121.     }
  122.   }
  123.  
  124.   return HTML;
  125. }
  126.  
  127. function  WWHPanels_InitLoaded()
  128. {
  129.   this.fClearScrollPosition();
  130.   this.mbLoading = false;
  131.   this.fReloadPanel();
  132. }
  133.  
  134. function  WWHPanels_PopupHTML()
  135. {
  136.   var  VarHTML = "";
  137.  
  138.  
  139.   if (WWHFrame.WWHBrowser.mbSupportsPopups)
  140.   {
  141.     VarHTML = this.mPopup.fDivTagText();
  142.   }
  143.  
  144.   return VarHTML;
  145. }
  146.  
  147. function  WWHPanels_ClearScrollPosition()
  148. {
  149.   var  PanelEntry;
  150.  
  151.  
  152.   PanelEntry = this.fGetCurrentPanelEntry();
  153.  
  154.   PanelEntry.mScrollPosition[0] = 0;
  155.   PanelEntry.mScrollPosition[1] = 0;
  156. }
  157.  
  158. function  WWHPanels_SaveScrollPosition()
  159. {
  160.   var  PanelEntry;
  161.   var  PanelObject;
  162.   var  VarPanelViewFrame;
  163.  
  164.  
  165.   if ( ! this.mbLoading)
  166.   {
  167.     // Access panel object
  168.     //
  169.     PanelEntry  = this.fGetCurrentPanelEntry();
  170.     PanelObject = this.fGetCurrentPanelObject();
  171.     if (PanelObject.mbPanelInitialized)
  172.     {
  173.       VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));
  174.  
  175.       if ((WWHFrame.WWHBrowser.mBrowser == 1) ||  // Shorthand for Netscape
  176.           (WWHFrame.WWHBrowser.mBrowser == 3) ||  // Shorthand for iCab
  177.           (WWHFrame.WWHBrowser.mBrowser == 4) ||  // Shorthand for Netscape 6.0 (Mozilla)
  178.           (WWHFrame.WWHBrowser.mBrowser == 5))    // Shorthand for Safari
  179.       {
  180.         PanelEntry.mScrollPosition[0] = VarPanelViewFrame.window.pageXOffset;
  181.         PanelEntry.mScrollPosition[1] = VarPanelViewFrame.window.pageYOffset;
  182.       }
  183.       else if (WWHFrame.WWHBrowser.mBrowser == 2)  // Shorthand for IE
  184.       {
  185.         // Test required to avoid JavaScript error under IE5.5 on Windows
  186.         //
  187.         if (typeof(VarPanelViewFrame.document.body) == "undefined")
  188.         {
  189.           PanelEntry.mScrollPosition[0] = 0;
  190.           PanelEntry.mScrollPosition[1] = 0;
  191.         }
  192.         else
  193.         {
  194.           if ((typeof(VarPanelViewFrame.document.documentElement) != "undefined") &&
  195.               (typeof(VarPanelViewFrame.document.documentElement.scrollLeft) != "undefined") &&
  196.               (typeof(VarPanelViewFrame.document.documentElement.scrollTop) != "undefined") &&
  197.               ((VarPanelViewFrame.document.documentElement.scrollLeft != 0) ||
  198.                (VarPanelViewFrame.document.documentElement.scrollTop != 0)))
  199.           {
  200.             PanelEntry.mScrollPosition[0] = VarPanelViewFrame.document.documentElement.scrollLeft;
  201.             PanelEntry.mScrollPosition[1] = VarPanelViewFrame.document.documentElement.scrollTop;
  202.           }
  203.           else
  204.           {
  205.             PanelEntry.mScrollPosition[0] = VarPanelViewFrame.document.body.scrollLeft;
  206.             PanelEntry.mScrollPosition[1] = VarPanelViewFrame.document.body.scrollTop;
  207.           }
  208.         }
  209.       }
  210.     }
  211.   }
  212. }
  213.  
  214. function  WWHPanels_RestoreScrollPosition()
  215. {
  216.   var  PanelEntry;
  217.   var  ScrollPosition;
  218.  
  219.  
  220.   if ( ! this.mbLoading)
  221.   {
  222.     // Access panel entry
  223.     //
  224.     PanelEntry = this.fGetCurrentPanelEntry();
  225.  
  226.     // See if a target position has been specified
  227.     //
  228.     if (PanelEntry.mPanelObject.mPanelAnchor != null)
  229.     {
  230.       this.fJumpToAnchor();
  231.     }
  232.     else
  233.     {
  234.       // Restore scroll position
  235.       //
  236.       ScrollPosition = PanelEntry.mScrollPosition;
  237.  
  238.       // setTimeout required for correct operation in Netscape 6.0
  239.       //
  240.       setTimeout(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".window.scrollTo(" + ScrollPosition[0] + ", " + ScrollPosition[1] + ");", 10);
  241.     }
  242.   }
  243. }
  244.  
  245. function  WWHPanels_JumpToAnchor()
  246. {
  247.   var  PanelObject;
  248.   var  bVarEnableNavigatorWorkaround;
  249.   var  VarPanelViewFrame;
  250.  
  251.  
  252.   if ( ! this.mbLoading)
  253.   {
  254.     // Access panel object
  255.     //
  256.     PanelObject = this.fGetCurrentPanelObject();
  257.     if ((PanelObject.mbPanelInitialized) &&
  258.         (PanelObject.mPanelAnchor != null))
  259.     {
  260.       if (WWHFrame.WWHBrowser.mbSupportsFocus)
  261.       {
  262.         // Use focus() method
  263.         //
  264.         WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame", PanelObject.mPanelAnchor);
  265.  
  266.         PanelObject.mPanelAnchor = null;
  267.       }
  268.       else
  269.       {
  270.         // Navigator reloads the page if the hash isn't already defined
  271.         //
  272.         bVarEnableNavigatorWorkaround = false;
  273.         VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));
  274.         if (WWHFrame.WWHBrowser.mBrowser == 1)  // Shorthand for Netscape
  275.         {
  276.           if (VarPanelViewFrame.location.hash.length == 0)
  277.           {
  278.             bVarEnableNavigatorWorkaround = true;
  279.           }
  280.         }
  281.  
  282.         // Jump to anchor
  283.         //
  284.         VarPanelViewFrame.location.hash = PanelObject.mPanelAnchor;
  285.  
  286.         // Navigator reloads the page if the hash isn't already defined
  287.         //
  288.         if ( ! bVarEnableNavigatorWorkaround)
  289.         {
  290.           PanelObject.mPanelAnchor = null;
  291.         }
  292.       }
  293.     }
  294.   }
  295. }
  296.  
  297. function  WWHPanels_ChangePanel(ParamPanelIndex)
  298. {
  299.   if (( ! this.mbChangingPanels) &&
  300.       ( ! this.mbLoading))
  301.   {
  302.     // Set flag
  303.     //
  304.     this.mbChangingPanels = true;
  305.  
  306.     // Save scroll position
  307.     //
  308.     this.fSaveScrollPosition();
  309.  
  310.     // Close down any popups we had going to prevent JavaScript errors
  311.     //
  312.     this.mPopup.fHide();
  313.  
  314.     // Set panel index
  315.     //
  316.     this.mCurrentPanel = ParamPanelIndex;
  317.  
  318.     // Update current panel
  319.     //
  320.     this.fReloadPanel();
  321.   }
  322. }
  323.  
  324. function  WWHPanels_ReloadPanel()
  325. {
  326.   var  PanelObject;
  327.   var  HTMLFilename;
  328.  
  329.  
  330.   if ( ! this.mbLoading)
  331.   {
  332.     // Set flag
  333.     //
  334.     this.mbLoading = true;
  335.  
  336.     // Access panel object
  337.     //
  338.     PanelObject = this.fGetCurrentPanelObject();
  339.  
  340.     // Determine file to load
  341.     //
  342.     if ( ! PanelObject.mbPanelInitialized)
  343.     {
  344.       HTMLFilename = "panelmsg.htm";
  345.     }
  346.     else
  347.     {
  348.       HTMLFilename = PanelObject.mPanelFilename;
  349.     }
  350.  
  351.     // Redirect to the correct file
  352.     //
  353.     WWHFrame.WWHHelp.fReplaceLocation("WWHPanelFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/" + HTMLFilename);
  354.   }
  355. }
  356.  
  357. function  WWHPanels_ReloadNavigation()
  358. {
  359.   if ( ! this.mbLoading)
  360.   {
  361.     // Set flag
  362.     //
  363.     this.mbLoading = true;
  364.  
  365.     this.mbReloadOnlyNavigation = true;
  366.  
  367.     WWHFrame.WWHHelp.fReplaceLocation("WWHPanelNavigationFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelnav.htm");
  368.   }
  369. }
  370.  
  371. function  WWHPanels_ReloadView()
  372. {
  373.   var  ExtraAction;
  374.   var  VarPanelViewFrame;
  375.  
  376.  
  377.   if ( ! this.mbLoading)
  378.   {
  379.     // Save scroll position
  380.     //
  381.     this.fSaveScrollPosition();
  382.  
  383.     // Set flag
  384.     //
  385.     this.mbLoading = true;
  386.  
  387.     // Close down any popups we had going to prevent JavaScript errors
  388.     //
  389.     this.mPopup.fHide();
  390.  
  391.     // Handle browser specific issues
  392.     //
  393.     ExtraAction = "";
  394.     if ((WWHFrame.WWHBrowser.mBrowser == 1) ||  // Shorthand for Netscape
  395.         (WWHFrame.WWHBrowser.mBrowser == 4))    // Shorthand for Netscape 6.0 (Mozilla)
  396.     {
  397.       // Navigator has trouble if the hash is defined
  398.       //
  399.       VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));
  400.       if (VarPanelViewFrame.location.hash.length != 0)
  401.       {
  402.         ExtraAction = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".location.hash = \"\"; ";
  403.  
  404.         if (WWHFrame.WWHBrowser.mBrowser == 4)  // Shorthand for Netscape 6.0 (Mozilla)
  405.         {
  406.           ExtraAction += WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelvie.htm") + "\"); "
  407.         }
  408.       }
  409.     }
  410.  
  411.     setTimeout(ExtraAction + WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelvie.htm") + "\");", 1);
  412.   }
  413. }
  414.  
  415. function  WWHPanels_PanelNavigationLoaded()
  416. {
  417.   var  PanelObject;
  418.  
  419.  
  420.   // Access panel object
  421.   //
  422.   PanelObject = this.fGetCurrentPanelObject();
  423.  
  424.   // Set frame name for accessibility
  425.   //
  426.   if (WWHFrame.WWHHelp.mbAccessible)
  427.   {
  428.     WWHFrame.WWHHelp.fSetFrameName("WWHPanelNavigationFrame");
  429.   }
  430.  
  431.   // Update flag
  432.   //
  433.   if (this.mbReloadOnlyNavigation)
  434.   {
  435.     this.mbLoading = false;
  436.   }
  437.  
  438.   // Notify panel object navigation loaded
  439.   //
  440.   PanelObject.fPanelNavigationLoaded();
  441.  
  442.   // Load view panel
  443.   //
  444.   if (this.mbReloadOnlyNavigation)
  445.   {
  446.     this.mbReloadOnlyNavigation = false;
  447.   }
  448.   else
  449.   {
  450.     WWHFrame.WWHHelp.fReplaceLocation("WWHPanelViewFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelvie.htm");
  451.   }
  452. }
  453.  
  454. function  WWHPanels_PanelViewLoaded()
  455. {
  456.   var  PanelObject;
  457.  
  458.  
  459.   // Set frame name for accessibility
  460.   //
  461.   if (WWHFrame.WWHHelp.mbAccessible)
  462.   {
  463.     WWHFrame.WWHHelp.fSetFrameName("WWHPanelViewFrame");
  464.   }
  465.  
  466.   // Update flag
  467.   //
  468.   this.mbLoading = false;
  469.  
  470.   // Restore window position
  471.   //
  472.   this.fRestoreScrollPosition();
  473.  
  474.   // Update popup window reference
  475.   //
  476.   this.mPopup.mWindowRef = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame")
  477.  
  478.   // Access panel object
  479.   //
  480.   PanelObject = this.fGetCurrentPanelObject();
  481.  
  482.   // Notify panel object view loaded
  483.   //
  484.   PanelObject.fPanelViewLoaded();
  485.  
  486.   // Complete changing tabs
  487.   //
  488.   if (this.mbChangingPanels)
  489.   {
  490.     // Notify end of tab change
  491.     //
  492.     WWHFrame.WWHJavaScript.fEndChangeTab();
  493.  
  494.     this.mbChangingPanels = false;
  495.   }
  496. }
  497.  
  498. function  WWHPanelHoverText_Translate(ParamEntryID)
  499. {
  500.   var  Text = "";
  501.   var  PanelObject;
  502.  
  503.  
  504.   // Access panel object
  505.   //
  506.   PanelObject = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject();
  507.   if (PanelObject.mbPanelInitialized)
  508.   {
  509.     Text = PanelObject.fHoverTextTranslate(ParamEntryID);
  510.   }
  511.  
  512.   return Text;
  513. }
  514.  
  515. function  WWHPanelHoverText_Format(ParamWidth,
  516.                                    ParamTextID,
  517.                                    ParamText)
  518. {
  519.   var  HTML = "";
  520.   var  PanelObject;
  521.  
  522.  
  523.   // Access panel object
  524.   //
  525.   PanelObject = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject();
  526.   if (PanelObject.mbPanelInitialized)
  527.   {
  528.     HTML = PanelObject.fHoverTextFormat(ParamWidth, ParamTextID, ParamText);
  529.   }
  530.  
  531.   return HTML;
  532. }
  533.