root / trunk / web / dojo / dojox / analytics / plugins / mouseClick.js @ 10
History | View | Annotate | Download (1.2 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.analytics.plugins.mouseClick"]){ |
||
9 | dojo._hasResource["dojox.analytics.plugins.mouseClick"]=true; |
||
10 | dojo.require("dojox.analytics._base");
|
||
11 | dojo.provide("dojox.analytics.plugins.mouseClick");
|
||
12 | dojox.analytics.plugins.mouseClick=new (function(){ |
||
13 | this.addData=dojo.hitch(dojox.analytics,"addData","mouseClick"); |
||
14 | this.onClick=function(e){ |
||
15 | this.addData(this.trimEvent(e)); |
||
16 | }; |
||
17 | dojo.connect(dojo.doc,"onclick",this,"onClick"); |
||
18 | this.trimEvent=function(e){ |
||
19 | var t={};
|
||
20 | for(var i in e){ |
||
21 | switch(i){
|
||
22 | case "target": |
||
23 | case "originalTarget": |
||
24 | case "explicitOriginalTarget": |
||
25 | var _1=["id","className","nodeName","localName","href","spellcheck","lang"]; |
||
26 | t[i]={}; |
||
27 | for(var j=0;j<_1.length;j++){ |
||
28 | if(e[i][_1[j]]){
|
||
29 | if(_1[j]=="text"||_1[j]=="textContent"){ |
||
30 | if((e[i]["localName"]!="HTML")&&(e[i]["localName"]!="BODY")){ |
||
31 | t[i][_1[j]]=e[i][_1[j]].substr(0,50); |
||
32 | } |
||
33 | }else{
|
||
34 | t[i][_1[j]]=e[i][_1[j]]; |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | break;
|
||
39 | case "clientX": |
||
40 | case "clientY": |
||
41 | case "pageX": |
||
42 | case "pageY": |
||
43 | case "screenX": |
||
44 | case "screenY": |
||
45 | t[i]=e[i]; |
||
46 | break;
|
||
47 | } |
||
48 | } |
||
49 | return t;
|
||
50 | }; |
||
51 | })(); |
||
52 | } |