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-13.0.0.beta4 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-13.0.0.beta3 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-13.0.0.beta2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-13.0.0.beta1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.2.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.1.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.4 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.3 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.1 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc7 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc6 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc5 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc4 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc3 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc2 app/assets/javascripts/pageflow/slideshow/hide_text.js
pageflow-12.0.0.rc1 app/assets/javascripts/pageflow/slideshow/hide_text.js