simple dist, global tap listener

This commit is contained in:
Adam Bradley
2013-09-25 13:35:10 -05:00
parent 37d708b05e
commit 1e6a0c1959
30 changed files with 387 additions and 129 deletions

74
dist/ionic.js vendored
View File

@ -150,38 +150,38 @@ if ( document.readyState === "complete" ) {
gesture.off(type, callback);
},
// With a click event, we need to check the target
// and if it's an internal target that doesn't want
// a click, cancel it
handleClick: function(e) {
var target = e.target;
// // With a click event, we need to check the target
// // and if it's an internal target that doesn't want
// // a click, cancel it
// handleClick: function(e) {
// var target = e.target;
if(ionic.Gestures.HAS_TOUCHEVENTS) {
// We don't allow any clicks on mobile
e.preventDefault();
return false;
}
// if(ionic.Gestures.HAS_TOUCHEVENTS) {
// // We don't allow any clicks on mobile
// e.preventDefault();
// return false;
// }
if (
! target
|| e.which > 1
|| e.metaKey
|| e.ctrlKey
//|| isScrolling
// || location.protocol !== target.protocol
// || location.host !== target.host
// // Not sure abotu this one
// //|| !target.hash && /#/.test(target.href)
// || target.hash && target.href.replace(target.hash, '') === location.href.replace(location.hash, '')
//|| target.getAttribute('data-ignore') == 'push'
) {
// Allow it
return;
}
// We need to cancel this one
e.preventDefault();
// if (
// ! target
// || e.which > 1
// || e.metaKey
// || e.ctrlKey
// //|| isScrolling
// // || location.protocol !== target.protocol
// // || location.host !== target.host
// // // Not sure abotu this one
// // //|| !target.hash && /#/.test(target.href)
// // || target.hash && target.href.replace(target.hash, '') === location.href.replace(location.hash, '')
// //|| target.getAttribute('data-ignore') == 'push'
// ) {
// // Allow it
// return;
// }
// // We need to cancel this one
// e.preventDefault();
},
// },
handlePopState: function(event) {
console.log("EVENT: popstate", event);
@ -196,8 +196,9 @@ if ( document.readyState === "complete" ) {
ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }
ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }
// DISABLING FOR NOW. THE TAP CODE AT THE EXT LEVEL SHOULD BE DOING THIS
// Set up various listeners
window.addEventListener('click', ionic.EventController.handleClick);
//window.addEventListener('click', ionic.EventController.handleClick);
})(window.ionic);
;/**
@ -292,9 +293,16 @@ if ( document.readyState === "complete" ) {
ionic.Gestures.event.determineEventTypes();
// Register all gestures inside ionic.Gestures.gestures
for(var name in ionic.Gestures.gestures) {
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
if(this === this.window) {
// this is a window, only add these
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
} else {
// everything else but the window
for(var name in ionic.Gestures.gestures) {
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
}
}
}