Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / analytics / plugins / idle.js @ 9

History | View | Annotate | Download (1.03 KB)

1
/*
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.idle"]){
9
dojo._hasResource["dojox.analytics.plugins.idle"]=true;
10
dojo.require("dojox.analytics._base");
11
dojo.provide("dojox.analytics.plugins.idle");
12
dojox.analytics.plugins.idle=new (function(){
13
this.addData=dojo.hitch(dojox.analytics,"addData","idle");
14
this.idleTime=dojo.config["idleTime"]||60000;
15
this.idle=true;
16
this.setIdle=function(){
17
this.addData("isIdle");
18
this.idle=true;
19
};
20
dojo.addOnLoad(dojo.hitch(this,function(){
21
var _1=["onmousemove","onkeydown","onclick","onscroll"];
22
for(var i=0;i<_1.length;i++){
23
dojo.connect(dojo.doc,_1[i],this,function(e){
24
if(this.idle){
25
this.idle=false;
26
this.addData("isActive");
27
this.idleTimer=setTimeout(dojo.hitch(this,"setIdle"),this.idleTime);
28
}else{
29
clearTimeout(this.idleTimer);
30
this.idleTimer=setTimeout(dojo.hitch(this,"setIdle"),this.idleTime);
31
}
32
});
33
}
34
}));
35
})();
36
}