Sha256: 67ee967f2a26fc34ffefd88e63a7a9cf7cc68425c7dc8cf89dbe735dc7ca28eb

Contents?: true

Size: 1.52 KB

Versions: 20

Compression:

Stored size: 1.52 KB

Contents

(function($) {
  var creatingMethods = ['reinit', 'reactivate', 'activate', 'activateAsLandingPage', 'prepare', 'linkedPages'];
  var ignoredMethods = ['cleanup', 'refreshScroller', 'resize', 'preload', 'deactivate', 'unprepare'];

  var prototype = {
    _create: function() {
      this.configuration = this.element.data('configuration') || this.options.configuration;
      this.index = this.options.index;
    },

    _destroy: function() {
      this.isDestroyed = true;
    },

    _ensureCreated: function() {
      this.created = true;
      this.element.nonLazyPage(this.options);
    },

    _delegateToInner: function(method, args) {
      return this.element.nonLazyPage.apply(this.element, [method].concat([].slice.call(args)));
    },

    getPermaId: function() {
      return parseInt(this.element.attr('id'), 10);
    },

    getConfiguration: function() {
      return this.configuration;
    },

    update: function(configuration) {
      if (this.created) {
        this._delegateToInner('update', arguments);
      }
      else {
        _.extend(this.configuration, configuration.attributes);
      }
    }
  };

  _(creatingMethods).each(function(method) {
    prototype[method] = function() {
      this._ensureCreated();
      return this._delegateToInner(method, arguments);
    };
  });

  _(ignoredMethods).each(function(method) {
    prototype[method] = function() {
      if (this.created) {
        return this._delegateToInner(method, arguments);
      }
    };
  });

  $.widget('pageflow.page', prototype);
}(jQuery));

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pageflow-13.0.0.beta6 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-13.0.0.beta5 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-13.0.0.beta4 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-13.0.0.beta3 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-13.0.0.beta2 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-13.0.0.beta1 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.2.0 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.1.0 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.4 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.3 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.2 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.1 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc7 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc6 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc5 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc4 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc3 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc2 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js
pageflow-12.0.0.rc1 app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js