Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
1.2 KB
|
Line | |
---|
1 | define(["dojo/_base/lang","../_base", "dojo/_base/window", "dojo/on" |
---|
2 | ], function(lang, dxa, window, on){ |
---|
3 | /*===== |
---|
4 | dxa = dojox.analytics; |
---|
5 | on = dojo.on; |
---|
6 | =====*/ |
---|
7 | |
---|
8 | // window startup data |
---|
9 | return (dxa.plugins.mouseClick = new (function(){ |
---|
10 | this.addData = lang.hitch(dxa, "addData", "mouseClick"); |
---|
11 | |
---|
12 | this.onClick=function(e){ |
---|
13 | this.addData(this.trimEvent(e)); |
---|
14 | } |
---|
15 | on(window.doc, "click", lang.hitch(this, "onClick")); |
---|
16 | |
---|
17 | this.trimEvent=function(e){ |
---|
18 | var t = {}; |
---|
19 | for (var i in e){ |
---|
20 | switch(i){ |
---|
21 | case "target": |
---|
22 | case "originalTarget": |
---|
23 | case "explicitOriginalTarget": |
---|
24 | var props=["id","className","nodeName", "localName","href", "spellcheck", "lang"]; |
---|
25 | t[i]={}; |
---|
26 | for(var j=0;j<props.length;j++){ |
---|
27 | if(e[i][props[j]]){ |
---|
28 | if (props[j]=="text" || props[j]=="textContent"){ |
---|
29 | if ((e[i]["localName"]!="HTML")&&(e[i]["localName"]!="BODY")){ |
---|
30 | t[i][props[j]]=e[i][props[j]].substr(0,50); |
---|
31 | } |
---|
32 | }else{ |
---|
33 | t[i][props[j]]=e[i][props[j]]; |
---|
34 | } |
---|
35 | } |
---|
36 | } |
---|
37 | break; |
---|
38 | case "clientX": |
---|
39 | case "clientY": |
---|
40 | case "pageX": |
---|
41 | case "pageY": |
---|
42 | case "screenX": |
---|
43 | case "screenY": |
---|
44 | t[i]=e[i]; |
---|
45 | break; |
---|
46 | } |
---|
47 | } |
---|
48 | return t; |
---|
49 | } |
---|
50 | })()); |
---|
51 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.