autoroute.js
Advanced tools
Comparing version 1.0.23 to 1.0.24
@@ -7,3 +7,3 @@ import Touch from 'hammerjs' | ||
routes : {}, | ||
t : { link : [], back : [] } | ||
t : { link : [], back : [], tap : [] } | ||
} | ||
@@ -16,3 +16,3 @@ | ||
e.className = 'route hide' | ||
e.className = 'route scroll hide' | ||
e.slide = false | ||
@@ -61,9 +61,11 @@ e.q = {} | ||
route.t.link.destroy ? route.t.link.forEach( e => e.destroy() ) : | ||
route.t.back.destroy ? route.t.back.forEach( e => e.destroy() ) : | ||
route.t = { link : [], back : [] } | ||
if ( route.t.link[0] ) { | ||
route.t.link.forEach( e => e.destroy() ) | ||
route.t.back.forEach( e => e.destroy() ) | ||
route.t.tap.forEach( e => e.destroy() ) | ||
} | ||
el('[link]', (el, i) => { | ||
route.t.link[i] = new Touch(el, { touchAction: 'pan-x pan-y' }) | ||
route.t.link[i] = new Touch.Manager(el) | ||
route.t.link[i].add(new Touch.Tap()) | ||
route.t.link[i].on('tap', ev => { | ||
@@ -73,4 +75,4 @@ | ||
if ( !window.location.hash.split('?')[1] ) { | ||
document.querySelectorAll('.active')[0].classList.remove('active') | ||
if (ev.target.offsetParent.tagName == 'FOOTER') { | ||
document.querySelectorAll('footer .active')[0].classList.remove('active') | ||
ev.target.classList.add('active') | ||
@@ -83,5 +85,18 @@ } | ||
el('[back]', (el, i) => { | ||
route.t.back[i] = new Touch(el, { touchAction: 'pan-x pan-y' }) | ||
route.t.back[i] = new Touch.Manager(el) | ||
route.t.back[i].add(new Touch.Tap()) | ||
route.t.back[i].on('tap', () => history.go(-1) ) | ||
}) | ||
el('[ontap]', (el, i) => { | ||
route.t.tap[i] = new Touch.Manager(el) | ||
route.t.tap[i].add(new Touch.Tap()) | ||
route.t.tap[i].on('tap', ev => { | ||
var fn = () => eval(ev.target.getAttribute('ontap')) | ||
fn.call(route.routes[window.location.hash.split('#/')[1]]) | ||
}) | ||
}) | ||
} | ||
@@ -100,3 +115,2 @@ | ||
!e ? fn(form) : console.log('Your form inputs are generating some errors.') | ||
}) | ||
@@ -208,4 +222,2 @@ } | ||
height: ${ r }; | ||
overflow-y: scroll; | ||
-webkit-overflow-scrolling: touch; | ||
background-color: #fafafa; | ||
@@ -217,2 +229,7 @@ animation-duration: 0.3s; | ||
.scroll { | ||
overflow: scroll; | ||
-webkit-overflow-scrolling: touch; | ||
} | ||
.hide { | ||
@@ -219,0 +236,0 @@ display : none |
{ | ||
"name": "autoroute.js", | ||
"version": "1.0.23", | ||
"version": "1.0.24", | ||
"description": "Another lightweight javascript routing framework ", | ||
@@ -5,0 +5,0 @@ "main": "autoroute.js", |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
6956
214
1