Sha256: 2eb347342c032457fcf5791e6ecc4922a386f2cfd29a80347de3fe4a9d59c62b

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

pageflow.AdjacentPages = pageflow.Object.extend({
  initialize: function(pages, scrollNavigator) {
    this.pages = pages;
    this.scrollNavigator = scrollNavigator;
  },

  of: function(page) {
    var result = [];
    var pages = this.pages();
    var nextPage = this.nextPage(page);

    if (nextPage.length) {
      result.push(nextPage.page('instance'));
    }

    _(page.linkedPages()).each(function(permaId) {
      var linkedPage = pages.filter('#' + permaId);

      if (linkedPage.length) {
        result.push(linkedPage.page('instance'));
      }
    }, this);

    return result;
  },

  nextPage: function(page) {
    var nextPage = this.scrollNavigator.getNextPage(page.element, this.pages());
    return nextPage.length && nextPage.page('instance');
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pageflow-12.3.0 app/assets/javascripts/pageflow/slideshow/adjacent_pages.js