Sha256: 89413e420f646b8047ce2cde1dafb14943c3e978d2afddaed41667020d11b164

Contents?: true

Size: 990 Bytes

Versions: 8

Compression:

Stored size: 990 Bytes

Contents

pageflow.outlineNavigationBar.events = (function() {
  var hasPointerEvents = window.PointerEvent || window.MSPointerEvent;

  return {
    pointerUp: hasPointerEvents ? 'MSPointerUp pointerup mouseup' : 'touchend mouseup',
    pointerDown: hasPointerEvents ? 'MSPointerDown pointerdown mousedown' : 'touchstart mousedown',

    onPointerDown: function(element, selectorOrHandler, handler) {
      var selector = handler ? selectorOrHandler : null;
      handler = handler || selectorOrHandler;

      this._onPointerDown(handler, function(event, fn) {
        element.on(event, selector, fn);
      });
    },

    _onPointerDown: function(handler, on) {
      on(this.pointerDown, function(event) {
        event.preventDefault();
        handler.call(this);
      });

      on('click', function(event) {
        event.preventDefault();
      });

      on('keypress', function(event) {
        if (event.which == 13) {
          handler.call(this);
        }
      });
    },
  };
}());

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pageflow-outline-navigation-bar-1.6.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.5.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.4.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.3.1 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.3.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.2.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.1.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js
pageflow-outline-navigation-bar-1.0.0 app/assets/javascript/pageflow/outline_navigation_bar/events.js