- Timestamp:
- 10/12/12 12:44:10 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-htmlmonitor/src/main/js/autoquest-htmlmonitor.js
r858 r869 58 58 'onmouseout' , 'onmousemove' ,'onfocus','onscroll']; // edit*/ 59 59 60 60 /** 61 * stores events, which were recorded but not sent to the server yet 62 */ 61 63 var recordedEvents = []; 62 64 63 65 /** 64 * isautomatically executed to initialize the event handling66 * automatically executed to initialize the event handling 65 67 */ 66 68 (function() { … … 88 90 89 91 /** 90 * traverses the DOM-structure of the HTML-si de, and adds event handling attributes to each92 * traverses the DOM-structure of the HTML-site, and adds event handling attributes to each 91 93 * relevant node 92 94 * 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 95 99 */ 96 100 function addEventHandlingAttributes(node, parentPath) { … … 127 131 128 132 /** 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 130 146 */ 131 147 function getNodePath(node, parentPath) { … … 170 186 171 187 /** 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 176 198 */ 177 199 function handleEvent(eventName, nodePath, event) { … … 211 233 212 234 /** 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 214 237 */ 215 238 function sendRequest() { … … 268 291 269 292 /** 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 271 299 */ 272 300 function getEventCoordinates(event) { … … 302 330 303 331 /** 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 305 335 */ 306 336 function readClientId() { … … 342 372 343 373 /** 344 * 374 * stores the provided client id in the cookies 375 * 376 * @param clientId the client id to be stored 345 377 */ 346 378 function storeClientId(clientId) { … … 355 387 356 388 /** 357 * 389 * returns the name of the cookie used to store the client id 390 * 391 * @returns as described 358 392 */ 359 393 function getClientIdCookieName() { … … 362 396 363 397 /** 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 365 402 */ 366 403 function generateClientId() { … … 369 406 370 407 /** 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 372 412 */ 373 413 function getClientIdPrefix() { … … 389 429 390 430 /** 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 392 434 */ 393 435 function log(text) { … … 419 461 } 420 462 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 */ 421 469 function Event(type, nodePath) { 422 470 this.type = type;
Note: See TracChangeset
for help on using the changeset viewer.