skrollr-rails 0.6.16 → 0.6.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c81290ed073e2155007ec15149cf1bc759b6d53
4
- data.tar.gz: 4ee1a773f944d7b1828037a3c5c80d82610f115a
3
+ metadata.gz: 0f2a4e524513a3fcc1bce8801cd4e0c4988582d1
4
+ data.tar.gz: 929ee48321fdc2726e0592fbf883123ebe30370f
5
5
  SHA512:
6
- metadata.gz: bbd79792287a6d4c5dbfa56eaa208ee026600ccfb431c76d8498b3f9e891f7400fdfd2acd1923853eaf8b07c823a5f79e0e4b9ebc4965edc34ce6632ee06b26c
7
- data.tar.gz: 30b55e4dea3e1e43ab48a3aa3b39f84da1767aeb969f5b9351b9c85479eecd49f2add883130a8ccfb20c88c12c922796eb01f48bea9e8b3f3f8bf38fb5011f28
6
+ metadata.gz: afdc7eff57a77a7cff835b81efd9394c7e28a01cf904c16683a52407ed5e2b9fa65f0db78b41cb95bef7e9545e1682afdc1751a73508126d9bf5e08db3c2fdb9
7
+ data.tar.gz: c6d2fca63f09370db4b16b36790ac0d564325c6543ff8ecaf21a04d66a5a7a17522780548199d3c768c04495c69aa080b2d41a3893ac3a73e5dc9f67075d4e0a
@@ -1,5 +1,5 @@
1
1
  module Skrollr
2
2
  module Rails
3
- VERSION = "0.6.16"
3
+ VERSION = "0.6.17"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@
19
19
  init: function(options) {
20
20
  return _instance || new Skrollr(options);
21
21
  },
22
- VERSION: '0.6.15'
22
+ VERSION: '0.6.17'
23
23
  };
24
24
 
25
25
  //Minify optimization.
@@ -60,6 +60,8 @@
60
60
  //The property which will be added to the DOM element to hold the ID of the skrollable.
61
61
  var SKROLLABLE_ID_DOM_PROPERTY = '___skrollable_id';
62
62
 
63
+ var rxTouchIgnoreTags = /^(?:input|textarea|button|select)$/i;
64
+
63
65
  var rxTrim = /^\s+|\s+$/g;
64
66
 
65
67
  //Find all data-attributes. data-[_constant]-[offset]-[anchor]-[anchor].
@@ -670,6 +672,7 @@
670
672
  var initialElement;
671
673
  var initialTouchY;
672
674
  var initialTouchX;
675
+ var currentElement;
673
676
  var currentTouchY;
674
677
  var currentTouchX;
675
678
  var lastTouchY;
@@ -681,14 +684,23 @@
681
684
  var deltaTime;
682
685
 
683
686
  _addEvent(documentElement, [EVENT_TOUCHSTART, EVENT_TOUCHMOVE, EVENT_TOUCHCANCEL, EVENT_TOUCHEND].join(' '), function(e) {
684
- e.preventDefault();
685
-
686
687
  var touch = e.changedTouches[0];
687
688
 
689
+ currentElement = e.target;
690
+
691
+ //We don't want text nodes.
692
+ while(currentElement.nodeType === 3) {
693
+ currentElement = currentElement.parentNode;
694
+ }
695
+
688
696
  currentTouchY = touch.clientY;
689
697
  currentTouchX = touch.clientX;
690
698
  currentTouchTime = e.timeStamp;
691
699
 
700
+ if(!rxTouchIgnoreTags.test(currentElement.tagName)) {
701
+ e.preventDefault();
702
+ }
703
+
692
704
  switch(e.type) {
693
705
  case EVENT_TOUCHSTART:
694
706
  //The last element we tapped on.
@@ -698,12 +710,7 @@
698
710
 
699
711
  _instance.stopAnimateTo();
700
712
 
701
- initialElement = e.target;
702
-
703
- //We don't want text nodes.
704
- while(initialElement.nodeType === 3) {
705
- initialElement = initialElement.parentNode;
706
- }
713
+ initialElement = currentElement;
707
714
 
708
715
  initialTouchY = lastTouchY = currentTouchY;
709
716
  initialTouchX = currentTouchX;
@@ -728,12 +735,14 @@
728
735
 
729
736
  //Check if it was more like a tap (moved less than 7px).
730
737
  if(distance2 < 49) {
731
- initialElement.focus();
738
+ if(!rxTouchIgnoreTags.test(initialElement.tagName)) {
739
+ initialElement.focus();
732
740
 
733
- //It was a tap, click the element.
734
- var clickEvent = document.createEvent('MouseEvent');
735
- clickEvent.initEvent('click', true, true);
736
- initialElement.dispatchEvent(clickEvent);
741
+ //It was a tap, click the element.
742
+ var clickEvent = document.createEvent('MouseEvents');
743
+ clickEvent.initMouseEvent('click', true, true, e.view, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, 0, null);
744
+ initialElement.dispatchEvent(clickEvent);
745
+ }
737
746
 
738
747
  return;
739
748
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skrollr-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.16
4
+ version: 0.6.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Reed