<commit_before>_ = require 'underscore'
Backbone = require 'backbone'
ShareView = require '../../../../components/share/view.coffee'
{ Following, FollowButton } = require '../../../../components/follow_button/index.coffee'

module.exports = class ArtistHeaderView extends Backbone.View
  initialize: ({ @user }) ->
    @setupShareButtons()
    @setupFollowButton()
    @$window = $ window
    @$window.on 'scroll', @popLock

  setupShareButtons: ->
    new ShareView el: @$('.artist-share')

  setupFollowButton: ->
    @following = new Following(null, kind: 'artist') if @user
    new FollowButton
      analyticsFollowMessage: 'Followed artist, via artist header'
      analyticsUnfollowMessage: 'Unfollowed artist, via artist header'
      el: @$('#artist-follow-button')
      following: @following
      modelName: 'artist'
      model: @model
    new FollowButton
      analyticsFollowMessage: 'Followed artist, via artist header'
      analyticsUnfollowMessage: 'Unfollowed artist, via artist header'
      el: @$('#artist-sticky-follow-button')
      following: @following
      modelName: 'artist'
      model: @model
    @following?.syncFollows [@model.id]

  popLock: =>
    mainHeaderHeight = $('#main-layout-header').height()
    bottomOfMenu = @$window.scrollTop() + mainHeaderHeight
    tabsOffset = @$('.artist-sticky-header').offset().top
    if tabsOffset <= bottomOfMenu
      @$('.artist-sticky-header').addClass('artist-sticky-header-fixed')
      responsiveMargin = $('.main-layout-container').offset().left

    else
      @$('.artist-sticky-header').removeClass('artist-sticky-header-fixed')

<commit_msg>last reference to id instead of class<commit_after>_ = require 'underscore'
Backbone = require 'backbone'
ShareView = require '../../../../components/share/view.coffee'
{ Following, FollowButton } = require '../../../../components/follow_button/index.coffee'

module.exports = class ArtistHeaderView extends Backbone.View
  initialize: ({ @user }) ->
    @setupShareButtons()
    @setupFollowButton()
    @$window = $ window
    @$window.on 'scroll', @popLock

  setupShareButtons: ->
    new ShareView el: @$('.artist-share')

  setupFollowButton: ->
    @following = new Following(null, kind: 'artist') if @user
    new FollowButton
      analyticsFollowMessage: 'Followed artist, via artist header'
      analyticsUnfollowMessage: 'Unfollowed artist, via artist header'
      el: @$('#artist-follow-button')
      following: @following
      modelName: 'artist'
      model: @model
    new FollowButton
      analyticsFollowMessage: 'Followed artist, via artist header'
      analyticsUnfollowMessage: 'Unfollowed artist, via artist header'
      el: @$('.artist-sticky-follow-button')
      following: @following
      modelName: 'artist'
      model: @model
    @following?.syncFollows [@model.id]

  popLock: =>
    mainHeaderHeight = $('#main-layout-header').height()
    bottomOfMenu = @$window.scrollTop() + mainHeaderHeight
    tabsOffset = @$('.artist-sticky-header').offset().top
    if tabsOffset <= bottomOfMenu
      @$('.artist-sticky-header').addClass('artist-sticky-header-fixed')
      responsiveMargin = $('.main-layout-container').offset().left

    else
      @$('.artist-sticky-header').removeClass('artist-sticky-header-fixed')


{'fraction_non_alphanumeric': 0.1480804387568556, 'fraction_numerical': 0.0, 'mean_word_length': 3.5470914127423825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2256546', 'n_tokens_mistral': 966, 'n_tokens_neox': 955, 'n_words': 210}