scrollToItem($item, noAnimation, force, bottom) {
    const $container = $('html, body').stop(true);

    if ($item.length) {
      const itemTop = $item.offset().top - this.getMarginTop();
      const itemBottom = $item.offset().top + $item.height();
      const scrollTop = $(document).scrollTop();
      const scrollBottom = scrollTop + $(window).height();

      // If the item is already in the viewport, we may not need to scroll.
      // If we're scrolling to the bottom of an item, then we'll make sure the
      // bottom will line up with the top of the composer.
      if (force || itemTop < scrollTop || itemBottom > scrollBottom) {
        const top = bottom
          ? itemBottom - $(window).height() + app.composer.computedHeight()
          : ($item.is(':first-child') ? 0 : itemTop);

        if (noAnimation) {
          $container.scrollTop(top);
        } else if (top !== scrollTop) {
          $container.animate({scrollTop: top}, 'fast');
        }
      }
    }

    return $container.promise();
  }
/**
   * Scroll down to the given post.
   *
   * @param {jQuery} $item
   * @param {Boolean} noAnimation
   * @param {Boolean} force Whether or not to force scrolling to the item, even
   *     if it is already in the viewport.
   * @param {Boolean} bottom Whether or not to scroll to the bottom of the post
   *     at the given index, instead of the top of it.
   * @return {jQuery.Deferred}
   */
Scroll down to the given post.
@param {jQuery} $item
@param {Boolean} noAnimation
@param {Boolean} force Whether or not to force scrolling to the item, even
if it is already in the viewport.
@param {Boolean} bottom Whether or not to scroll to the bottom of the post
at the given index, instead of the top of it.
Scroll down to the given post . @param { jQuery } $item @param { Boolean } noAnimation @param { Boolean } force Whether or not to force scrolling to the item even if it is already in the viewport . @param { Boolean } bottom Whether or not to scroll to the bottom of the post at the given index instead of the top of it .
scrollToItem($item, noAnimation, force, bottom) {
    const $container = $('html, body').stop(true);
    if ($item.length) {
      const itemTop = $item.offset().top - this.getMarginTop();
      const itemBottom = $item.offset().top + $item.height();
      const scrollTop = $(document).scrollTop();
      const scrollBottom = scrollTop + $(window).height();
      if (force || itemTop < scrollTop || itemBottom > scrollBottom) {
        const top = bottom
          ? itemBottom - $(window).height() + app.composer.computedHeight()
          : ($item.is(':first-child') ? 0 : itemTop);
        if (noAnimation) {
          $container.scrollTop(top);
        } else if (top !== scrollTop) {
          $container.animate({scrollTop: top}, 'fast');
        }
      }
    }
    return $container.promise();
  }
scrollToItem ( $item , noAnimation , force , bottom ) { const $container = $ ( 'html, body' ) . stop ( true ) ; if ( $item . length ) { const itemTop = $item . offset ( ) . top - this . getMarginTop ( ) ; const itemBottom = $item . offset ( ) . top + $item . height ( ) ; const scrollTop = $ ( document ) . scrollTop ( ) ; const scrollBottom = scrollTop + $ ( window ) . height ( ) ; if ( force || itemTop < scrollTop || itemBottom > scrollBottom ) { const top = bottom ? itemBottom - $ ( window ) . height ( ) + app . composer . computedHeight ( ) : ( $item . is ( ':first-child' ) ? 0 : itemTop ) ; if ( noAnimation ) { $container . scrollTop ( top ) ; } else if ( top !== scrollTop ) { $container . animate ( { scrollTop : top } , 'fast' ) ; } } } return $container . promise ( ) ; }
Scroll down to the given post.
Scroll down to the given post .
// If the item is already in the viewport, we may not need to scroll. // If we're scrolling to the bottom of an item, then we'll make sure the // bottom will line up with the top of the composer.