home *** CD-ROM | disk | FTP | other *** search
/ ftp.swcp.com / ftp.swcp.com.zip / ftp.swcp.com / mac / mozilla-mac-0.9.sea.hqx / mozilla-mac-0.9 / Chrome / help.jar / content / help / help.js < prev    next >
Text File  |  2001-05-05  |  5KB  |  124 lines

  1. //-------- global variables
  2.  
  3. var gBrowser;
  4. var key = {
  5.  "?mail": "chrome://help/locale/mail_help.html",
  6.  "?nav":  "chrome://help/locale/nav_help.html",
  7.  "?im":    "chrome://help/locale/im_help.html",
  8.  "?sec":   "chrome://help/locale/security_help.html",
  9.  "?cust":  "chrome://help/locale/customize_help.html",
  10.  "?comp":  "chrome://help/locale/composer_help.html",
  11.  
  12.  "?my_certs":  "chrome://help/locale/certs_help.html#My_Certificates",
  13.  "?cert_backup_pwd":  "chrome://help/locale/certs_help.html#Choose_a_Certificate_Backup_Password",
  14.  "?delete_my_certs":  "chrome://help/locale/certs_help.html#Delete_My_Certificate",
  15.  "?change_pwd":  "chrome://help/locale/passwords_help.html#Change_Master_Password",
  16.  "?web_certs":  "chrome://help/locale/certs_help.html#Web_Site_Certificates",
  17.  "?edit_web_certs":  "chrome://help/locale/certs_help.html#Edit_Web_Site_Certificate_Settings",
  18.  "?delete_web_certs":  "chrome://help/locale/certs_help.html#Delete_Web_Site_Certificate",
  19.  "?ca_certs":  "chrome://help/locale/certs_help.html#CA_Certificates",
  20.  "?edit_ca_certs":  "chrome://help/locale/certs_help.html#Edit_CA_Certificate_Settings",
  21.  "?delete_ca_certs":  "chrome://help/locale/certs_help.html#Delete_CA_Certificate",
  22.  "?sec_devices":  "chrome://help/locale/certs_help.html#Security_Devices",
  23.  
  24.  "?cert_details":  "chrome://help/locale/cert_dialog_help.html#Certificate_Details",
  25.  "?which_token":  "chrome://help/locale/cert_dialog_help.html#Choose_Security_Device",
  26.  "?priv_key_copy":  "chrome://help/locale/cert_dialog_help.html#Encryption_Key_Copy",
  27.  "?backup_your_cert":  "chrome://help/locale/cert_dialog_help.html#Certificate_Backup",
  28.  "?which_cert":  "chrome://help/locale/cert_dialog_help.html#User_Identification_Request",
  29.  "?no_cert":  "chrome://help/locale/cert_dialog_help.html#User_Identification_Request",
  30.  "?new_ca":  "chrome://help/locale/cert_dialog_help.html#New_Certificate_Authority",
  31.  "?new_web_cert":  "chrome://help/locale/cert_dialog_help.html#New_Web_Site_Certificate",
  32.  "?exp_web_cert":  "chrome://help/locale/cert_dialog_help.html#Expired_Web_Site_Certificate",
  33.  "?not_yet_web_cert":  "chrome://help/locale/cert_dialog_help.html#Web_Site_Certificate_Not_Yet_Valid",
  34.  "?bad_name_web_cert":  "chrome://help/locale/cert_dialog_help.html#Unexpected_Certificate_Name",
  35.  
  36.  "?sec_gen":  "chrome://help/locale/privsec_help.html#privsec_help_first",
  37.  "?ssl_prefs":  "chrome://help/locale/ssl_help.html#ssl_first",
  38.  "?validation_prefs":  "chrome://help/locale/ssl_help.html#ssl_first",
  39.  "?passwords_prefs":  "chrome://help/locale/ssl_help.html#ssl_first"
  40. }
  41.  
  42.  
  43. function init()
  44. {
  45.   // Initialize the Help window
  46.   //  "window.arguments[0]" is undefined or context string
  47.  
  48.   // move to right end of screen
  49.   var width = document.documentElement.getAttribute("width");
  50.   var height = document.documentElement.getAttribute("height");
  51.   window.moveTo(screen.availWidth-width, (screen.availHeight-height)/2);
  52.  
  53.   gBrowser = document.getElementById("help-content");
  54.   var sessionHistory =  Components.classes["@mozilla.org/browser/shistory;1"]
  55.                                   .createInstance(Components.interfaces.nsISHistory);
  56.  
  57.   getWebNavigation().sessionHistory = sessionHistory;
  58.  
  59.   //if ("argument" in window && window.arguments.length >= 1) {
  60.   //  browser.loadURI(window.arguments[0]);
  61.   //} else {
  62.   //  goHome(); // should be able to do browser.goHome();
  63.   //}
  64.  
  65.   if (window.location.search) {
  66.       loadURI(key[window.location.search]);
  67.       // selectTOC(key[window.location.search]);
  68.  
  69.   } else {
  70.       goHome();
  71.   }
  72. }
  73.  
  74. function selectTOC(link_attr) {
  75.   var items = document.getElementsByAttribute("helplink", link_attr);
  76.   if (items.length >= 1) {
  77.     var parentRow = items[0].parentNode;
  78.       var selectableNode = parentRow.parentNode;     // helplink is an attribute
  79.                               // on a treecell, which cannot be selected
  80.       var tree = document.getElementById("help-toc-tree");
  81.       tree.selectItem(selectableNode);
  82.   } 
  83. }
  84.  
  85.  
  86. function getWebNavigation()
  87. {
  88.   return gBrowser.webNavigation;
  89. }
  90.  
  91. function loadURI(aURI)
  92. {
  93.   const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  94.   getWebNavigation().loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE);
  95. }
  96.  
  97. function goBack()
  98. {
  99.   var webNavigation = getWebNavigation();
  100.   if (webNavigation.canGoBack)
  101.     webNavigation.goBack();
  102. }
  103.  
  104. function goForward()
  105. {
  106.   var webNavigation = getWebNavigation();
  107.   if (webNavigation.canGoForward)
  108.     webNavigation.goForward();
  109. }
  110.  
  111. function goHome() {
  112.   // load "Welcome" page
  113.   loadURI("chrome://help/locale/welcome_help.html");
  114. }
  115.  
  116. function print()
  117. {
  118.   try {
  119.     _content.print();
  120.   } catch (e) {
  121.   }
  122. }
  123.  
  124.