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 / _AD7F595C730246028728E7FEAB09C00C < prev    next >
Text File  |  2003-09-15  |  5KB  |  186 lines

  1. // Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHJavaScript_Object()
  5. {
  6.   this.mSettings           = new WWHJavaScriptSettings_Object();
  7.   this.mMessages           = new WWHJavaScriptMessages_Object();
  8.   this.mInitialTab         = -1;
  9.   this.mbClickedChangeTab  = false;
  10.   this.mbChangingTabs      = false;
  11.   this.mCurrentTab         = -1;
  12.   this.mPanels             = null;
  13.   this.mTabs               = null;
  14.   this.mMaxHTMLSegmentSize = 8192;  // Best tested value is 8192
  15.  
  16.   this.fInit                      = WWHJavaScript_Init;
  17.   this.fClickedChangeTab          = WWHJavaScript_ClickedChangeTab;
  18.   this.fClickedChangeTabWithDelay = WWHJavaScript_ClickedChangeTabWithDelay;
  19.   this.fStartChangeTab            = WWHJavaScript_StartChangeTab;
  20.   this.fEndChangeTab              = WWHJavaScript_EndChangeTab;
  21.   this.fSyncTOC                   = WWHJavaScript_SyncTOC;
  22.  
  23.   // Load up messages
  24.   //
  25.   this.mMessages.fSetByLocale(WWHFrame.WWHBrowser.mLocale);
  26.  
  27.   // Disable hover text for accessibility or if popups are not supported
  28.   //
  29.   if (( ! WWHFrame.WWHBrowser.mbSupportsPopups) ||
  30.       (WWHFrame.WWHHelp.mbAccessible))
  31.   {
  32.     this.mSettings.mHoverText.mbEnabled = false;
  33.   }
  34. }
  35.  
  36. function  WWHJavaScript_Init()
  37. {
  38.   // Create panels and tabs objects
  39.   //
  40.   this.mPanels = new WWHPanels_Object();
  41.   this.mTabs   = new WWHTabs_Object(this.mPanels.mPanelEntries.length);
  42.  
  43.   // Determine initial tab setting
  44.   //
  45.   switch (WWHFrame.WWHHelp.mInitialTabName)
  46.   {
  47.     case "contents":
  48.       this.mInitialTab = WWHFrame.WWHOutline.mPanelTabIndex;
  49.       break;
  50.  
  51.     case "index":
  52.       this.mInitialTab = WWHFrame.WWHIndex.mPanelTabIndex;
  53.       break;
  54.  
  55.     case "search":
  56.       this.mInitialTab = WWHFrame.WWHSearch.mPanelTabIndex;
  57.       break;
  58.   }
  59.   if (this.mInitialTab < 0)
  60.   {
  61.     this.mInitialTab = 0;
  62.   }
  63.  
  64.   // Complete initialization process
  65.   //
  66.   if ( ! WWHFrame.WWHHandler.mbInitialized)
  67.   {
  68.     WWHFrame.WWHHandler.mbInitialized = true;
  69.     WWHFrame.WWHHelp.fHandlerInitialized();
  70.   }
  71. }
  72.  
  73. function  WWHJavaScript_ClickedChangeTab(ParamIndex)
  74. {
  75.   if ( ! this.mbClickedChangeTab)
  76.   {
  77.     // Change tabs
  78.     //
  79.     this.mbClickedChangeTab = true;
  80.     this.fStartChangeTab(ParamIndex);
  81.   }
  82. }
  83.  
  84. function  WWHJavaScript_ClickedChangeTabWithDelay(ParamIndex)
  85. {
  86.   setTimeout("WWHFrame.WWHJavaScript.fClickedChangeTab(" + ParamIndex + ");", 1);
  87. }
  88.  
  89. function  WWHJavaScript_StartChangeTab(ParamIndex)
  90. {
  91.   if (( ! this.mbChangingTabs) &&
  92.       (this.mCurrentTab != ParamIndex))
  93.   {
  94.     // Signal that we are changing tabs
  95.     //
  96.     this.mbChangingTabs = true;
  97.  
  98.     // Update tab index
  99.     //
  100.     this.mCurrentTab = ParamIndex;
  101.  
  102.     // Update tab frame
  103.     //
  104.     this.mTabs.fReload();
  105.   }
  106. }
  107.  
  108. function  WWHJavaScript_EndChangeTab()
  109. {
  110.   if (this.mbClickedChangeTab)
  111.   {
  112.     this.mbClickedChangeTab = false;
  113.   }
  114.  
  115.   // Signal that the change tab process is complete
  116.   //
  117.   this.mbChangingTabs = false;
  118.  
  119.   // Perform additional processing if initial tab specified
  120.   //
  121.   if (WWHFrame.WWHHelp.mInitialTabName == "contents")
  122.   {
  123.     WWHFrame.WWHHelp.mInitialTabName = null;
  124.  
  125.     setTimeout("WWHFrame.WWHControls.fClickedSyncTOC();", 1);
  126.   }
  127. }
  128.  
  129. function  WWHJavaScript_SyncTOC(ParamBookIndex,
  130.                                 ParamFileIndex,
  131.                                 ParamAnchor)
  132. {
  133.   var  bVisible;
  134.   var  TabIndex;
  135.   var  Index;
  136.  
  137.  
  138.   // Confirm TOC is available as a tab
  139.   //
  140.   if (this.mSettings.mTOC.mbShow)
  141.   {
  142.     // Confirm file is part of a known book
  143.     //
  144.     if ((ParamBookIndex >= 0) &&
  145.         (ParamFileIndex >= 0))
  146.     {
  147.       // Determine visibility
  148.       //
  149.       bVisible = false;
  150.       if (this.mPanels.fGetCurrentPanelObject().mPanelTabTitle == this.mMessages.mTabsTOCLabel)
  151.       {
  152.         bVisible = true;
  153.       }
  154.  
  155.       // Sync TOC
  156.       //
  157.       WWHFrame.WWHOutline.fSync(ParamBookIndex, ParamFileIndex, ParamAnchor, bVisible);
  158.  
  159.       // Change tabs if not visible
  160.       //
  161.       if ( ! bVisible)
  162.       {
  163.         // Determine tab to display for TOC
  164.         //
  165.         TabIndex = -1;
  166.         Index = 0;
  167.         while ((TabIndex == -1) &&
  168.                (Index < WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length))
  169.         {
  170.           if (WWHFrame.WWHJavaScript.mPanels.mPanelEntries[Index].mPanelObject.mPanelTabTitle == WWHFrame.WWHJavaScript.mMessages.mTabsTOCLabel)
  171.           {
  172.             TabIndex = Index;
  173.           }
  174.  
  175.           Index++;
  176.         }
  177.  
  178.         if (TabIndex != -1)
  179.         {
  180.           WWHFrame.WWHJavaScript.fStartChangeTab(TabIndex);
  181.         }
  182.       }
  183.     }
  184.   }
  185. }
  186.