Attachment 'wwhapi-js.txt'

Download

   1 // Copyright (c) 2004-2004 Quadralay Corporation.  All rights reserved.
   2 //
   3 
   4 function WWHAPI_Object(ParamHelpURL,
   5                        ParamTargetWindow)
   6 {
   7   // Location of the WebWorks Help system to be launched.
   8   // Location should be an absolute URL.
   9   //
  10   this.mAPIURL       = ParamHelpURL + '/wwhelp/wwhimpl/api.htm';
  11   this.mWindow       = null;
  12   this.mTargetWindow = ParamTargetWindow;
  13 
  14   this.fLaunchHelp                = WWHAPI_LaunchHelp;
  15   this.fCloseHelp                 = WWHAPI_CloseHelp;
  16   this.fDisplayHelp               = WWHAPI_DisplayHelp;
  17   this.fDisplayHelpWithNavigation = WWHAPI_DisplayHelpWithNavigation;
  18   this.fDisplayHelpWithContents   = WWHAPI_DisplayHelpWithContents;
  19   this.fDisplayHelpWithIndex      = WWHAPI_DisplayHelpWithIndex;
  20   this.fDisplayHelpWithSearch     = WWHAPI_DisplayHelpWithSearch;
  21   this.fDisplayHelpWithFavorites  = WWHAPI_DisplayHelpWithFavorites;
  22   this.fDisplayHelpNavigation     = WWHAPI_DisplayHelpNavigation;
  23   this.fDisplayHelpContents       = WWHAPI_DisplayHelpContents;
  24   this.fDisplayHelpIndex          = WWHAPI_DisplayHelpIndex;
  25   this.fDisplayHelpSearch         = WWHAPI_DisplayHelpSearch;
  26   this.fDisplayHelpFavorites      = WWHAPI_DisplayHelpFavorites;
  27 }
  28 
  29 function WWHAPI_LaunchHelp(bParamSingle,
  30                            ParamContext,
  31                            ParamTopic,
  32                            ParamTab)
  33 {
  34   var  VarParameters;
  35   var  VarURL;
  36   var  VarIndex;
  37   var  VarMaxIndex;
  38 
  39 
  40   // Define parameters
  41   //
  42   VarParameters = new Array();
  43   if (bParamSingle)
  44   {
  45     VarParameters[VarParameters.length] = "single=true";
  46   }
  47   if (ParamContext != null)
  48   {
  49     VarParameters[VarParameters.length] = "context=" + ParamContext;
  50   }
  51   if (ParamTopic != null)
  52   {
  53     VarParameters[VarParameters.length] = "topic=" + ParamTopic;
  54   }
  55   if (ParamTab)
  56   {
  57     VarParameters[VarParameters.length] = "tab=" + ParamTab;
  58   }
  59 
  60   // Create URL
  61   //
  62   VarURL = this.mAPIURL;
  63   for (VarIndex = 0, VarMaxIndex = VarParameters.length ; VarIndex < VarMaxIndex ; VarIndex++)
  64   {
  65     if (VarIndex == 0)
  66     {
  67       VarURL += "?" + VarParameters[VarIndex];
  68     }
  69     else
  70     {
  71       VarURL += "&" + VarParameters[VarIndex];
  72     }
  73   }
  74 
  75   // Check to see if the window exists.  If it does, make the native call directly.
  76   // Otherwise, initialize the help system at the topic using URL params.
  77   //
  78   if ((this.mWindow != null) &&
  79       (typeof(this.mWindow) != "undefined") &&
  80       ( ! this.mWindow.closed) &&
  81       (this.mWindow.WWHHelp != null) &&
  82       (typeof(this.mWindow.WWHHelp) != "undefined"))
  83   {
  84     this.mWindow.focus();
  85     this.mWindow.WWHHelp.fSetContextDocument(VarURL);
  86   }
  87   else
  88   {
  89     // Use target window
  90     //
  91     if ((typeof(this.mTargetWindow) != "undefined") &&
  92         (this.mTargetWindow != null))
  93     {
  94       this.mWindow = window.open(VarURL, this.mTargetWindow);
  95     }
  96     else
  97     {
  98       this.mWindow = window.open(VarURL);
  99     }
 100 
 101     // Ensure window is brought to the foreground
 102     //
 103     this.mWindow.focus();
 104   }
 105 }
 106 
 107 function WWHAPI_CloseHelp()
 108 {
 109   if ((this.mWindow != null) &&
 110       (typeof(this.mWindow) != "undefined") &&
 111       ( ! this.mWindow.closed) &&
 112       (this.mWindow.WWHHelp != null) &&
 113       (typeof(this.mWindow.WWHHelp) != "undefined"))
 114   {
 115     this.mWindow.close();
 116   }
 117 }
 118 
 119 function WWHAPI_DisplayHelp(ParamContext,
 120                             ParamTopic)
 121 {
 122   this.fLaunchHelp(true, ParamContext, ParamTopic, null);
 123 }
 124 
 125 function WWHAPI_DisplayHelpWithNavigation(ParamContext,
 126                                           ParamTopic)
 127 {
 128   this.fLaunchHelp(false, ParamContext, ParamTopic, null);
 129 }
 130 
 131 function WWHAPI_DisplayHelpWithContents(ParamContext,
 132                                         ParamTopic)
 133 {
 134   this.fLaunchHelp(false, ParamContext, ParamTopic, "contents");
 135 }
 136 
 137 function WWHAPI_DisplayHelpWithIndex(ParamContext,
 138                                      ParamTopic)
 139 {
 140   this.fLaunchHelp(false, ParamContext, ParamTopic, "index");
 141 }
 142 
 143 function WWHAPI_DisplayHelpWithSearch(ParamContext,
 144                                       ParamTopic)
 145 {
 146   this.fLaunchHelp(false, ParamContext, ParamTopic, "search");
 147 }
 148 
 149 function WWHAPI_DisplayHelpWithFavorites(ParamContext,
 150                                          ParamTopic)
 151 {
 152   this.fLaunchHelp(false, ParamContext, ParamTopic, "favorites");
 153 }
 154 
 155 function WWHAPI_DisplayHelpNavigation()
 156 {
 157   this.fLaunchHelp(false, null, null, null);
 158 }
 159 
 160 function WWHAPI_DisplayHelpContents()
 161 {
 162   this.fLaunchHelp(false, null, null, "contents");
 163 }
 164 
 165 function WWHAPI_DisplayHelpIndex()
 166 {
 167   this.fLaunchHelp(false, null, null, "index");
 168 }
 169 
 170 function WWHAPI_DisplayHelpSearch()
 171 {
 172   this.fLaunchHelp(false, null, null, "search");
 173 }
 174 
 175 function WWHAPI_DisplayHelpFavorites()
 176 {
 177   this.fLaunchHelp(false, null, null, "favorites");
 178 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-02-13 06:16:03, 2.4 KB) [[attachment:example-html.txt]]
  • [get | view] (2008-02-13 06:16:03, 10.1 KB) [[attachment:readme-api.html]]
  • [get | view] (2008-02-13 06:16:03, 4110.3 KB) [[attachment:wwhapi-js-only-v4.0.7.zip]]
  • [get | view] (2008-02-13 06:16:03, 4.8 KB) [[attachment:wwhapi-js.txt]]
  • [get | view] (2008-02-13 06:16:03, 0.3 KB) [[attachment:wwhbaseurl-js.txt]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.