lesca-click
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -95,6 +95,14 @@ "use strict"; | ||
get: function get(e) { | ||
var localName = e.target.localName; | ||
var type = e.type; | ||
var key = e.target.id + '_id'; | ||
if (this.db[key]) { | ||
this.db[key](e); | ||
if (localName !== 'button') { | ||
this.db[key](e); | ||
} else { | ||
var device = this.detect(); | ||
if (device === 'mobile' && type === 'touchend') this.db[key](e);else if (device !== 'mobile' && type === 'mouseup') this.db[key](e); | ||
} | ||
return; | ||
@@ -106,3 +114,10 @@ } | ||
if (this.db[key]) { | ||
this.db[key](e); | ||
if (localName !== 'button') { | ||
this.db[key](e); | ||
} else { | ||
var _device = this.detect(); | ||
if (_device === 'mobile' && type === 'touchend') this.db[key](e);else if (_device !== 'mobile' && type === 'mouseup') this.db[key](e); | ||
} | ||
return; | ||
@@ -149,3 +164,9 @@ } | ||
} | ||
}, | ||
detect: function detect() { | ||
var MobileDetect = require('mobile-detect'), | ||
m = new MobileDetect(window.navigator.userAgent); | ||
if (m.tablet()) return 'mobile';else if (m.mobile()) return 'mobile';else return 'desktop'; | ||
} | ||
}; |
{ | ||
"name": "lesca-click", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "replace click / touch start on SPY page", | ||
@@ -50,3 +50,6 @@ "main": "lib/index.js", | ||
"url": "git@github.com:jameshsu1125/lesca-touch-event.git" | ||
}, | ||
"dependencies": { | ||
"mobile-detect": "^1.4.5" | ||
} | ||
} |
@@ -15,3 +15,3 @@ import React from 'react'; | ||
<> | ||
<div className='myDiv'>button</div> | ||
<button className='myDiv'>button</button> | ||
</> | ||
@@ -18,0 +18,0 @@ ); |
@@ -78,10 +78,26 @@ module.exports = { | ||
get(e) { | ||
const { localName } = e.target; | ||
const { type } = e; | ||
let key = e.target.id + '_id'; | ||
if (this.db[key]) { | ||
this.db[key](e); | ||
if (localName !== 'button') { | ||
this.db[key](e); | ||
} else { | ||
const device = this.detect(); | ||
if (device === 'mobile' && type === 'touchend') this.db[key](e); | ||
else if (device !== 'mobile' && type === 'mouseup') this.db[key](e); | ||
} | ||
return; | ||
} | ||
key = e.target.className + '_class'; | ||
if (this.db[key]) { | ||
this.db[key](e); | ||
if (localName !== 'button') { | ||
this.db[key](e); | ||
} else { | ||
const device = this.detect(); | ||
if (device === 'mobile' && type === 'touchend') this.db[key](e); | ||
else if (device !== 'mobile' && type === 'mouseup') this.db[key](e); | ||
} | ||
return; | ||
@@ -125,2 +141,10 @@ } | ||
}, | ||
detect() { | ||
let MobileDetect = require('mobile-detect'), | ||
m = new MobileDetect(window.navigator.userAgent); | ||
if (m.tablet()) return 'mobile'; | ||
else if (m.mobile()) return 'mobile'; | ||
else return 'desktop'; | ||
}, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15597
355
1
+ Addedmobile-detect@^1.4.5
+ Addedmobile-detect@1.4.5(transitive)