home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG787v-BUS_de / wwhelp / wwhimpl / js / scripts / javascpt.js < prev    next >
Text File  |  2007-06-22  |  4KB  |  177 lines

  1. // Copyright (c) 2000-2001 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.mbChangingTabs      = false;
  9.   this.mCurrentTab         = -1;
  10.   this.mPanels             = null;
  11.   this.mTabs               = null;
  12.   this.mMaxHTMLSegmentSize = 8192;  // Best tested value is 8192
  13.  
  14.   this.fInit                    = WWHJavaScript_Init;
  15.   this.fStartChangeTab          = WWHJavaScript_StartChangeTab;
  16.   this.fStartChangeTabWithDelay = WWHJavaScript_StartChangeTabWithDelay;
  17.   this.fEndChangeTab            = WWHJavaScript_EndChangeTab;
  18.   this.fSyncTOC                 = WWHJavaScript_SyncTOC;
  19.  
  20.   // Load up messages
  21.   //
  22.   this.mMessages.fSetByLocale(WWHFrame.WWHHelp.mLocale);
  23. }
  24.  
  25. function  WWHJavaScript_Init()
  26. {
  27.   var  InitialTab;
  28.  
  29.  
  30.   // Create panels and tabs objects
  31.   //
  32.   this.mPanels = new WWHPanels_Object();
  33.   this.mTabs   = new WWHTabs_Object();
  34.  
  35.   // Set inital tab to display
  36.   //
  37.   InitialTab = this.mTabs.fInit();
  38.  
  39.   // Display tab and panel
  40.   //
  41.   this.fStartChangeTab(InitialTab);
  42. }
  43.  
  44. function  WWHJavaScript_StartChangeTab(ParamIndex)
  45. {
  46.   if (( ! this.mbChangingTabs) &&
  47.       ((this.mCurrentTab == -1) ||
  48.        (this.mCurrentTab != ParamIndex)))
  49.   {
  50.     // Signal that we are changing tabs
  51.     //
  52.     this.mbChangingTabs = true;
  53.  
  54.     // Record current scroll position
  55.     //
  56.     if (this.mCurrentTab != -1)
  57.     {
  58.       this.mPanels.fSaveScrollPosition();
  59.     }
  60.  
  61.     // Update tab index
  62.     //
  63.     this.mCurrentTab = ParamIndex;
  64.  
  65.     // Update tab frame and panel frame
  66.     //
  67.     this.mTabs.fDisplayTab();
  68.     this.mPanels.fDisplayPanel();
  69.   }
  70. }
  71.  
  72. function  WWHJavaScript_StartChangeTabWithDelay(ParamIndex)
  73. {
  74.   setTimeout("WWHFrame.WWHJavaScript.fStartChangeTab(" + ParamIndex + ");", 1);
  75. }
  76.  
  77. function  WWHJavaScript_EndChangeTab()
  78. {
  79.   // Check for frame set reloading (back or forward button used)
  80.   //
  81.   if (WWHFrame.WWHHelp.mInitStage > 0)
  82.   {
  83.     // Restore window position
  84.     //
  85.     this.mPanels.fRestoreScrollPosition();
  86.   }
  87.  
  88.   // Signal that the change tab process is complete
  89.   //
  90.   this.mbChangingTabs = false;
  91.  
  92.   // Complete initialization process
  93.   //
  94.   if ( ! WWHFrame.WWHHandler.mbInitialized)
  95.   {
  96.     WWHFrame.WWHHandler.mbInitialized = true;
  97.     WWHFrame.WWHHelp.fHandlerInitialized();
  98.   }
  99. }
  100.  
  101. function  WWHJavaScript_SyncTOC(ParamHREF)
  102. {
  103.   // Confirm TOC is available as a tab
  104.   //
  105.   if (this.mSettings.mTOC.mbShow)
  106.   {
  107.     var  BookFileHREF;
  108.  
  109.  
  110.     // Confirm file is part of a known book
  111.     //
  112.     BookFileHREF = WWHFrame.WWHHelp.fGetBookFileHREF(ParamHREF);
  113.     if (BookFileHREF != null)
  114.     {
  115.       var  BookIndexFileHREF;
  116.       var  BookIndex;
  117.       var  FileHREF;
  118.  
  119.  
  120.       // Determine book index and file href
  121.       //
  122.       BookIndexFileHREF = WWHFrame.WWHHelp.mBooks.fGetBookIndexFileHREF(BookFileHREF)
  123.       BookIndex = BookIndexFileHREF[0];
  124.       FileHREF  = BookIndexFileHREF[1];
  125.  
  126.       // Sync outline if match found
  127.       //
  128.       if ((BookIndex != -1) &&
  129.           (FileHREF  != null))
  130.       {
  131.         var  bVisible = false;
  132.  
  133.  
  134.         // Determine visibility
  135.         //
  136.         if (this.mPanels.fGetCurrentPanelObject().mPanelTabTitle == this.mMessages.mTabsTOCLabel)
  137.         {
  138.           bVisible = true;
  139.         }
  140.  
  141.         // Sync TOC
  142.         //
  143.         WWHFrame.WWHOutline.fSync(BookIndex, FileHREF, bVisible);
  144.  
  145.         // Change tabs if not visible
  146.         //
  147.         if ( ! bVisible)
  148.         {
  149.           var  TabIndex;
  150.           var  Index;
  151.  
  152.  
  153.           // Determine tab to display for TOC
  154.           //
  155.           TabIndex = -1;
  156.           Index = 0;
  157.           while ((TabIndex == -1) &&
  158.                  (Index < WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length))
  159.           {
  160.             if (WWHFrame.WWHJavaScript.mPanels.mPanelEntries[Index].mPanelObject.mPanelTabTitle == WWHFrame.WWHJavaScript.mMessages.mTabsTOCLabel)
  161.             {
  162.               TabIndex = Index;
  163.             }
  164.  
  165.             Index++;
  166.           }
  167.  
  168.           if (TabIndex != -1)
  169.           {
  170.             WWHFrame.WWHJavaScript.fStartChangeTab(TabIndex);
  171.           }
  172.         }
  173.       }
  174.     }
  175.   }
  176. }
  177.