<commit_before>class Kandan.Helpers.Channels

  @options:
    autoScrollThreshold: 0.90
    maxActivities: 5

  @replaceCreateButton: ()->
    $tabNav = $(".create_channel").parent().parent()
    $createButton = $(".create_channel").parent().html()
    $tabNav.find(".create_channel").parent().remove()
    $tabNav.append("<li>"+$createButton+"</li>")

  @pastAutoScrollThreshold: (channelId)->
    currentPosition     = @currentScrollPosition channelId
    totalHeight         = $(document).height() - $(window).height()
    scrollPercentage    = (currentPosition) / (totalHeight)
    scrollPercentage > @options.autoScrollThreshold

  @scrollToLatestMessage: (channelId)->
    console.log("scrolling to last message");
    $('document').scrollTop($('document').height()+900)
    #@channel_activities_el(channelId).parent().scrollTop(100000)

  @currentScrollPosition: (channelId)->
    console.log("current scroll position");
    $('document').scrollTop()
    #@channel_activities_el(channelId).parent().scrollTop()

  @channel_activities_el: (channelId)->
    $("#channel-activities-#{channelId}")

  @channel_pagination_el: (channelId)->
    $("#channels-#{channelId} .pagination")

  @selected_tab: ()->
    $('#channels').tabs('option', 'selected')

  @getActiveChannelId: ()->
    if $(document).data('active_channel_id') == undefined
      return $("#channels .ui-tabs-panel")
        .eq(@selected_tab())
        .data('channel_id')<commit_msg>scrolling back in action<commit_after>class Kandan.Helpers.Channels

  @options:
    autoScrollThreshold: 0.90
    maxActivities: 5

  @replaceCreateButton: ()->
    $tabNav = $(".create_channel").parent().parent()
    $createButton = $(".create_channel").parent().html()
    $tabNav.find(".create_channel").parent().remove()
    $tabNav.append("<li>"+$createButton+"</li>")

  @pastAutoScrollThreshold: (channelId)->
    currentPosition     = @currentScrollPosition channelId
    totalHeight         = $(document).height() - $(window).height()
    scrollPercentage    = (currentPosition) / (totalHeight)
    scrollPercentage > @options.autoScrollThreshold

  @scrollToLatestMessage: (channelId)->
    console.log("scrolling to last message");
    $(document).scrollTop($(document).height()+9000)

  @currentScrollPosition: (channelId)->
    console.log("current scroll position");
    $(document).scrollTop()

  @channel_activities_el: (channelId)->
    $("#channel-activities-#{channelId}")

  @channel_pagination_el: (channelId)->
    $("#channels-#{channelId} .pagination")

  @selected_tab: ()->
    $('#channels').tabs('option', 'selected')

  @getActiveChannelId: ()->
    if $(document).data('active_channel_id') == undefined
      return $("#channels .ui-tabs-panel")
        .eq(@selected_tab())
        .data('channel_id')
{'fraction_non_alphanumeric': 0.17946877243359655, 'fraction_numerical': 0.007537688442211055, 'mean_word_length': 4.38030888030888, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '5828917', 'n_tokens_mistral': 847, 'n_tokens_neox': 825, 'n_words': 122}