Javascript commonInit - jcobban/Genealogy GitHub Wiki

Up: Javascript Global Services

Source: /jscripts/util.js

The function commonInit is called for all application-specific pages once the browser has loaded the document. Among other functionality it:

  1. adds an event handler for mouse button clicks that happen anywhere on the displayed document. This event handler closes any open modal dialog.
  2. adds an event handler for common key down events. This assists scrolling through large tables which are displayed in pages.
  3. adds an event handler for mouse button clicks on the menu button in the page header.
  4. computes the total width of all of the potential elements in the page header. If there is not enough room, hide the social media elements.
  5. If a registered user is signed on sets up the menu item to display the current user's account information and, if the user has requested it, suppress popup help. Otherwise sets up the menu item to provide the option to sign on or register as a new user.
  6. Activates popup help for all form elements.
  7. If the script is running as a result of being invoked for a page that was invoked by method=GET, initializes the global variable args to contain a JavaScript object which for each parameter passed to the server script contains a member which is identified by the parameter name shifted to lower case and contains the value of the parameter. If the object contains a member named 'debug' then it sets the global variable debug to its value. If the object contains a member named 'text' then it suppresses the activation of TinyMCE visual editors. If the object contains a member named 'lang' the it sets the global variable lang to its value.
  8. Specifies the action to take when the user resizes the page to the function commonResize. This hides or re-displays the social media portion of the page header depending upon whether there is enough space. This also supports the user changing the orientation of mobile devices.
  9. Specifies the action to taken when the page is scrolled as the function commonScroll. This implements handling of table displays which are too large to be displayed in a single page. This includes supporting the PgUp and PgDn keys for scrolling without removing the hands from the keyboard.
  10. Activates support for Facebook and other social media integration.

Next: function closeFrame(lastChoice)