Sha256: 079fd3fc86cae64cc1872f054d9a9580cedd8e8b635e21b26806c89e972b1106

Contents?: true

Size: 855 Bytes

Versions: 9

Compression:

Stored size: 855 Bytes

Contents

pageflow.outlineNavigationBar.Expander = pageflow.Object.extend({
  initialize: function(options) {
    this.options = options;
    this.expandedBy = {};
  },

  expand: function(options) {
    this.expandedBy[(options && options.by) || 'button'] = true;
    clearTimeout(this.collapseTimeout);

    if (!this.expanded && this.options.enabled()) {
      this.expanded = true;
      this.options.expand();
    }
  },

  collapse: function(options) {
    delete this.expandedBy[(options && options.by) || 'button'];
    clearTimeout(this.collapseTimeout);

    if (this.expanded && _.keys(this.expandedBy).length === 0) {
      this.expanded = false;
      this.options.collapse();
    }
  },

  scheduleCollapse: function(options) {
    var that = this;

    this.collapseTimeout = setTimeout(function() {
      that.collapse(options);
    }, 200);
  }
});

Version data entries

9 entries across 9 versions & 1 rubygems

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