home *** CD-ROM | disk | FTP | other *** search
/ ftp.novell.com / 2014.06.ftp.novell.com.tar / ftp.novell.com / forge / camtasia.msi / Cabs.w1.cab / CamtasiaStudio.chm / scripts / page.js < prev    next >
Text File  |  2009-08-19  |  5KB  |  199 lines

  1. // Copyright (c) 2002-2005 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  HTMLHelpUtility_NotifyClickedPopup()
  5. {
  6.   // Not a member function, need to access via variable
  7.   //
  8.   WebWorksHTMLHelp.mbPopupClicked = true;
  9. }
  10.  
  11. function  HTMLHelp_Object()
  12. {
  13.   this.mbPopupClicked  = false;
  14.   this.mbOverPopupLink = false;
  15.   this.mEvent          = null;
  16.   this.mPopup          = new HTMLHelpPopup_Object("WebWorksHTMLHelp.mPopup",
  17.                                                   "window",
  18.                                                   HTMLHelpUtility_NotifyClickedPopup,
  19.                                                   "HTMLHelpPopupDIV", "HTMLHelpPopupText",
  20.                                                   10, 12, 20, 200);
  21.   this.mPopupLoaded    = false;
  22.  
  23.   this.fNotifyClicked   = HTMLHelp_NotifyClicked;
  24.   this.fMouseOverPopup  = HTMLHelp_MouseOverPopup;
  25.   this.fMouseOutPopup   = HTMLHelp_MouseOutPopup;
  26.   this.fShowPopup       = HTMLHelp_ShowPopup;
  27.   this.fPopupAdjustSize = HTMLHelp_PopupAdjustSize;
  28.   this.fPopupLoaded     = HTMLHelp_PopupLoaded;
  29.   this.fRevealPopup     = HTMLHelp_RevealPopup;
  30.   this.fHidePopup       = HTMLHelp_HidePopup;
  31.   this.fPopupDivTag     = HTMLHelp_PopupDivTag;
  32. }
  33.  
  34. function  HTMLHelp_NotifyClicked()
  35. {
  36.   if (this.mbPopupClicked)
  37.   {
  38.     this.mbPopupClicked = false;
  39.   }
  40.   else if ( ! this.mbOverPopupLink)
  41.   {
  42.     this.fHidePopup();
  43.   }
  44. }
  45.  
  46. function  HTMLHelp_MouseOverPopup(ParamEvent)
  47. {
  48.   this.mbOverPopupLink = true;
  49.  
  50.   this.mEvent = new Object();
  51.   this.mEvent.x = ParamEvent.x;
  52.   this.mEvent.y = ParamEvent.y;
  53. }
  54.  
  55. function  HTMLHelp_MouseOutPopup()
  56. {
  57.   this.mbOverPopupLink = false;
  58. }
  59.  
  60. function  HTMLHelp_ShowPopup(ParamLink)
  61. {
  62.   var  VarHTML;
  63.  
  64.   if (this.mEvent != null)
  65.   {
  66.     VarHTML = "<iframe id=\"WWHPopupIFrame\" frameborder=\"0\" scrolling=\"no\" width=\"" + this.mPopup.mWidth + "\" src=\"" + ParamLink + "\" onload=\"javascript:WebWorksHTMLHelp.fPopupLoaded()\"></iframe>";
  67.     this.mbPopupClicked = false;
  68.     this.mPopup.fShow(VarHTML, this.mEvent);
  69.  
  70.     // WORKAROUND: Need to size popup after IFrame has loaded
  71.     //
  72.     if (this.mPopup.mSetTimeoutID != null)
  73.     {
  74.       clearTimeout(this.mPopup.mSetTimeoutID);
  75.       this.mPopup.mSetTimeoutID = null;
  76.  
  77.       this.mPopupLoaded = false;
  78.       this.mPopup.mSetTimeoutID = setTimeout("WebWorksHTMLHelp.fRevealPopup()", this.mPopup.mTimeout);
  79.     }
  80.   }
  81.  
  82.   this.mEvent = null;
  83. }
  84.  
  85. function  HTMLHelp_PopupAdjustSize()
  86. {
  87.   var  VarPopupWindow = eval(this.mPopup.mWindowRef);
  88.   var  VarPopupDocument = VarPopupWindow.document;
  89.   var  VarDocumentElement;
  90.   var  VarMaxHeight;
  91.   var  VarIFrame;
  92.   var  VarElement;
  93.   var  VarWidth;
  94.   var  VarHeight;
  95.   var  VarDistanceToRightEdge;
  96.  
  97.   // Access popup iframe
  98.   //
  99.   VarIFrame = VarPopupDocument.all['WWHPopupIFrame'];
  100.  
  101.   // Access document elements
  102.   //
  103.   if ((typeof(VarPopupDocument.documentElement) != "undefined") &&
  104.       (typeof(VarPopupDocument.documentElement.clientWidth) != "undefined") &&
  105.       (typeof(VarPopupDocument.documentElement.clientHeight) != "undefined") &&
  106.       ((VarPopupDocument.documentElement.clientWidth != 0) ||
  107.        (VarPopupDocument.documentElement.clientHeight != 0)))
  108.   {
  109.     VarDocumentElement = VarPopupDocument.documentElement;
  110.     VarElement = VarIFrame.contentWindow.document.documentElement;
  111.   }
  112.   else
  113.   {
  114.     VarDocumentElement = VarPopupDocument.body;
  115.     VarElement = VarIFrame.contentWindow.document.body;
  116.   }
  117.  
  118.   // Determine maximum height
  119.   //
  120.   VarMaxHeight = VarDocumentElement.clientHeight - 16;
  121.  
  122.   // Record width
  123.   //
  124.   VarWidth = (VarElement.scrollWidth > VarElement.offsetWidth) ? VarElement.scrollWidth : VarElement.offsetWidth;
  125.  
  126.   // Determine height
  127.   //
  128.   VarHeight = (VarElement.scrollHeight > VarElement.offsetHeight) ? VarElement.scrollHeight : VarElement.offsetHeight;
  129.   VarHeight += 4;
  130.   if (VarHeight > VarMaxHeight)
  131.   {
  132.     VarHeight = VarMaxHeight;
  133.  
  134.     // Find widest area to left or right of cursor position
  135.     //
  136.     VarDistanceToRightEdge = VarPopupDocument.documentElement.offsetWidth - this.mPopup.mPositionX;
  137.     if (VarDistanceToRightEdge < this.mPopup.mPositionX)
  138.     {
  139.       VarWidth = this.mPopup.mPositionX;
  140.     }
  141.     else
  142.     {
  143.       VarWidth = VarDistanceToRightEdge;
  144.     }
  145.   }
  146.  
  147.   // Update IFrame width/height
  148.   //
  149.   if (VarWidth > VarIFrame.style.width)
  150.   {
  151.     VarIFrame.style.width = VarWidth;
  152.   }
  153.   if (VarHeight > VarIFrame.style.height)
  154.   {
  155.     VarIFrame.style.height = VarHeight;
  156.   }
  157. }
  158.  
  159. function  HTMLHelp_PopupLoaded()
  160. {
  161.   this.fPopupAdjustSize();
  162.  
  163.   this.mPopupLoaded = true;
  164. }
  165.  
  166. function  HTMLHelp_RevealPopup()
  167. {
  168.   if (this.mPopupLoaded)
  169.   {
  170.     // Reveal
  171.     //
  172.     this.mPopup.fReveal();
  173.  
  174.     // Access popup IFrame
  175.     //
  176.     VarPopupDocument = eval(this.mPopup.mWindowRef + ".document");
  177.     VarIFrame = VarPopupDocument.all['WWHPopupIFrame'];
  178.     VarElement = VarIFrame.contentWindow.document.body;
  179.  
  180.     // "Toggle" IFrame content
  181.     //
  182.     VarElement.innerHTML = VarElement.innerHTML;
  183.   }
  184.   else
  185.   {
  186.     this.mPopup.mSetTimeoutID = setTimeout("WebWorksHTMLHelp.fRevealPopup()", 10);
  187.   }
  188. }
  189.  
  190. function  HTMLHelp_HidePopup()
  191. {
  192.   this.mPopup.fHide();
  193. }
  194.  
  195. function  HTMLHelp_PopupDivTag()
  196. {
  197.   return this.mPopup.fDivTagText();
  198. }
  199.