Sha256: ae4713c744020ee0b2c1d3eefdb2c3d5c4cd51518e9a5e52e7157a8a0862cc34

Contents?: true

Size: 1.09 KB

Versions: 58

Compression:

Stored size: 1.09 KB

Contents

pageflow.hideText = (function() {
  function element() {
    return $('body');
  }

  function prefix(event) {
    return _.map(event.split(' '), function(e) {
      return 'hidetext' + e;
    }).join(' ');
  }

  $(function() {
    element().on('keydown', function(event) {
      if(event.keyCode == 27) {
        pageflow.hideText.deactivate();
      }
    });
  });

  return {
    isActive: function() {
      return element().hasClass('hideText');
    },

    toggle: function() {
      if (this.isActive()) {
        this.deactivate();
      }
      else {
        this.activate();
      }
    },

    activate: function() {
      if (!this.isActive()) {
        element().addClass('hideText');
        element().trigger('hidetextactivate');
      }
    },

    deactivate: function() {
      if (this.isActive()) {
        element().removeClass('hideText');
        element().trigger('hidetextdeactivate');
      }
    },

    on: function(event, callback) {
      element().on(prefix(event), callback);
    },

    off: function(event, callback) {
      element().off(prefix(event), callback);
    }
  };
}());

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.5.1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.5.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0.rc2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0.rc1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0.beta4 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0.beta3 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.4.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0.beta2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-15.0.0.beta1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.3.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.2.1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.2.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.1.1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.1.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.0.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-14.0.0.rc2 app/assets/javascripts/pageflow/slideshow/hide_text.js