Ignore:
Timestamp:
10/12/12 12:44:10 (12 years ago)
Author:
pharms
Message:
  • added some comments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-htmlmonitor/src/main/js/autoquest-htmlmonitor.js

    r858 r869  
    5858'onmouseout' , 'onmousemove' ,'onfocus','onscroll'];  // edit*/ 
    5959 
    60  
     60/** 
     61 * stores events, which were recorded but not sent to the server yet 
     62 */ 
    6163var recordedEvents = []; 
    6264 
    6365/** 
    64  * is automatically executed to initialize the event handling 
     66 * automatically executed to initialize the event handling 
    6567 */ 
    6668(function() { 
     
    8890 
    8991/** 
    90  * traverses the DOM-structure of the HTML-side, and adds event handling attributes to each 
     92 * traverses the DOM-structure of the HTML-site, and adds event handling attributes to each 
    9193 * relevant node 
    9294 *  
    93  * @param node the node of the DOM structure that shall be adapted and whose children shall be 
    94  *             traversed 
     95 * @param node       the node of the DOM structure that shall be adapted and whose children shall 
     96 *                   be traversed 
     97 * @param parentPath the path to the parent node of the provided node within the DOM-structure of 
     98 *                   the HTML-site 
    9599 */ 
    96100function addEventHandlingAttributes(node, parentPath) { 
     
    127131 
    128132/** 
    129  *  
     133 * generates a path through the DOM-structure of the HTML-site depending on a node and the path 
     134 * to its parent node. The result is the parent path plus a path element for the provided node. 
     135 * If the node has a tag name, this is the first part of the path element generated for the node. 
     136 * If the node has an id, it becomes the second part of the path element. If the node does not have 
     137 * an id, the method calculates the index of the node within all children of the same type within 
     138 * the parent node. This index becomes then the second part of the path element generated for the 
     139 * node.  
     140 *  
     141 * @param node       the node of the DOM structure for which the path shall be created 
     142 * @param parentPath the path to the parent node of the provided node 
     143 *  
     144 * @returns a path in the DOM-structure of the HTML-site including the parent path an a path 
     145 *          element for the provided node 
    130146 */ 
    131147function getNodePath(node, parentPath) { 
     
    170186 
    171187/** 
    172  * handles an event that happened on a node 
    173  *  
    174  * @param node 
    175  * @returns {Boolean} 
     188 * handles an event that happened on a node. This method is called by the event handling attributes 
     189 * of the nodes. These attributes are generated by the 
     190 * {@link #addEventHandlingAttributes(node,parentPath)} function. It creates a new Event object and 
     191 * add it to the list of <code>recordedEvents</code>. If this list achieves the maximum 
     192 * <code>packageSize</code> the events in the list are sent to the server asynchronously through 
     193 * calling {@link #sendRequest()}. 
     194 *  
     195 * @param eventName the name of the event, e.g. onscroll 
     196 * @param nodePath  the path to the node in the HTML DOM on which the event occurred 
     197 * @param event     the HTML event that occured 
    176198 */ 
    177199function handleEvent(eventName, nodePath, event) { 
     
    211233 
    212234/** 
    213  * sends the collected data to the server, named in the destination-variable 
     235 * sends the collected data to the server, named in the destination-variable. For this it generates 
     236 * a JSON formatted message and uses Ajax and the <code>destination</code> to send it to the server 
    214237 */ 
    215238function sendRequest() { 
     
    268291 
    269292/** 
    270  * determines the coordinates of an onclick or ondblclick event 
     293 * determines the coordinates of an onclick or ondblclick event. If the coordinates to not come 
     294 * with the provided event, they are determined based on the surrounding object 
     295 *  
     296 * @param event the event to extract the coordinates of 
     297 *  
     298 * @returns the coordinates of the event as an array with x and y coordinate 
    271299 */ 
    272300function getEventCoordinates(event) { 
     
    302330 
    303331/** 
    304  *  
     332 * reads the id of the client from the cookies. 
     333 *  
     334 * @returns the client id or null, if none is found in the cookies 
    305335 */ 
    306336function readClientId() { 
     
    342372 
    343373/** 
    344  *  
     374 * stores the provided client id in the cookies 
     375 *  
     376 * @param clientId the client id to be stored 
    345377 */ 
    346378function storeClientId(clientId) { 
     
    355387 
    356388/** 
    357  *  
     389 * returns the name of the cookie used to store the client id 
     390 *  
     391 * @returns as described 
    358392 */ 
    359393function getClientIdCookieName() { 
     
    362396 
    363397/** 
    364  *  
     398 * generates a client id based on the result of {@link #getClientIdPrefix()} and the current time 
     399 * stamp 
     400 *  
     401 * @returns the client id 
    365402 */ 
    366403function generateClientId() { 
     
    369406 
    370407/** 
    371  *  
     408 * generates a client id prefix based on the user agent and the navigators platform. The prefix 
     409 * is a simple checksum of the concatenation of both strings 
     410 *  
     411 * @returns the client id prefix 
    372412 */ 
    373413function getClientIdPrefix() { 
     
    389429 
    390430/** 
    391  * performs a simple logging 
     431 * performs a simple logging by adding a specific div to the HTML 
     432 *  
     433 * @param text the text to be logged 
    392434 */ 
    393435function log(text) { 
     
    419461} 
    420462 
     463/** 
     464 * this class represents a single event 
     465 *  
     466 * @param type     the type of the event 
     467 * @param nodePath the path through the HTML DOM to the event target 
     468 */ 
    421469function Event(type, nodePath) { 
    422470    this.type = type; 
Note: See TracChangeset for help on using the changeset viewer.