PageRenderTime 12ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/js/tool.js

https://bitbucket.org/baniol/mobilang
JavaScript | 35 lines | 17 code | 5 blank | 13 comment | 2 complexity | 980e41007fef2d95e32545562e512226 MD5 | raw file
 1var fijsTool = {
 2	
 3	/**
 4	 * True if mobile
 5	 */
 6	mobileDevice: false,
 7	
 8	/**
 9	 * Click/touch event trigger (mobile/fix)
10	 */
11	triggerEvent:null,
12	
13	/**
14	 * Global settings
15	 */
16	initFijsTool: function(){
17		// mobile detect
18		if(this.detectMobile()){
19			this.startEvent = 'touchstart';
20			this.endEvent = 'touchend';
21		}else{
22			this.startEvent = 'mousedown';
23			this.endEvent = 'mouseup';
24		}
25	},
26	
27	/**
28	 * Returns true if mobile browser
29	 */
30	detectMobile: function(){
31		var check = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/);
32		return check !== null || this.phonegap ? true: false;
33	}	
34	
35}