<commit_before><%= content_for :javascript do %>
  
  $("#excursions_tab").click(function(){
    re_apply_pageless("excursions");
  });

  var resources_tab_loaded = false;
  $("#resources_tab").click(function(){
    if(resources_tab_loaded===false){
      $('.loader_pagination').show();
      resources_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/resources",
          success : function(html) {
            $('.loader_pagination').hide();      
            $("#resources_tab_ready").append(html);
            re_apply_pageless("resources");
            re_apply_backstrech("resources");
          },
          error: function(){
            //console.log("error loading resources");
         }
        });

    } else {
      re_apply_pageless("resources");
    }
  });

  var events_tab_loaded = false;
  $("#events_tab").click(function(){
    if(events_tab_loaded===false){
      $('.loader_pagination').show();
      events_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/events",
          success : function(html) {  
            $('.loader_pagination').hide();
            $("#events_tab_ready").append(html);
            re_apply_pageless("events");
            re_apply_backstrech("events");
          },
          error: function(){
            //console.log("error loading events");
         }
        });

    } else {
      re_apply_pageless("events");
    }
  });

  var categories_tab_loaded = false;
  $("#categories_tab").click(function(){
    if(categories_tab_loaded===false){
      $('.loader_pagination').show();
      categories_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/categories",
          success : function(html) {      
            $('.loader_pagination').hide();
            $("#categories_tab_ready").append(html);
            re_apply_pageless("categories");
          },
          error: function(){
            //console.log("error loading categories");
         }
        });
    } else {
      re_apply_pageless("categories");
    }
  });

  var followers_tab_loaded = false;
  $("#followers_tab").click(function(){
    if(followers_tab_loaded===false){
      $('.loader_pagination').show();
      followers_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/followers",
          success : function(html) {
            $('.loader_pagination').hide();
            $("#followers_ul").prepend(html);
            re_apply_pageless("followers");
          },
          error: function(){
            //console.log("error loading followers");
         }
        });
    } else {
      re_apply_pageless("followers");
    }
  });

  var followings_tab_loaded = false;
  $("#followings_tab").click(function(){
    if(followings_tab_loaded===false){
      $('.loader_pagination').show();
      followings_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/followings",
          success : function(html) {
            $('.loader_pagination').hide();   
            $("#followings_ul").prepend(html);
            re_apply_pageless("followings");
          },
          error: function(){
            //console.log("error loading followings");
         }
        });

    } else {
      re_apply_pageless("followings");
    }
  });
<%end%>

<script>
//important that this is here and not in document ready, so they are defined when document is ready and we can use them
var pageless_state = {
      "excursions":{
        "url": "<%= user_url(profile_subject) %>",
        "num_pages":0,
        "current_page":0
      },
      "events":{
        "url": "<%= user_url(profile_subject) %>/events",
        "num_pages":0,
        "current_page":0
      },
      "resources":{
        "url": "<%= user_url(profile_subject) %>/resources",
        "num_pages":0,
        "current_page":0
      },
      "categories":{
        "url": "<%= user_url(profile_subject) %>/categories",
        "num_pages":0,
        "current_page":0
      },
      "followers":{
        "url": "<%= user_url(profile_subject) %>/followers",
        "num_pages":0,
        "current_page":0
      },
      "followings":{
        "url": "<%= user_url(profile_subject) %>/followings",
        "num_pages":0,
        "current_page":0
      }
    };

function update_pageless_state(tab, num_pages, current_page){
    pageless_state[tab].num_pages = num_pages;
    pageless_state[tab].current_page = current_page;
}

function re_apply_pageless(tab){
    //first remove old pageless
    $.pagelessStop();
    $("#" + tab + "_tab_ready ul").pageless({ 
                    totalPages: pageless_state[tab].num_pages ,
                    url: get_url_with_sort_by(tab),
                    currentPage: pageless_state[tab].current_page,
                    loader: '.loader_pagination',
                    end: function(){
                      $('.loader_pagination').hide();
                    }
    });
  }

function get_url_with_sort_by(tab){
  var the_url = pageless_state[tab].url;

  the_url = the_url + "?sort_by=" + $("#order_by_selector_" + tab).attr("li_selected");
  return the_url;
}

  function re_apply_backstrech(tab){
    $("#" + tab + "_tab_ready"  + " div[bs-img]").each(function() {
          if($(this).parents(".tab-pane").css('display')!="none"){        
            $(this).backstretch( $(this).attr("bs-img") );   
            if($(this).parents(".tab-pane").css('display')=="none"){
              $(this).attr("fix-bs", "true");
            }
          }
          else{
            $(this).attr("fix-bs", "true");
          }   
    });
  };

    $(window).on('resize.backstretch', set_fix_bs_on_hidden_tabs)
             .on('orientationchange.backstretch', set_fix_bs_on_hidden_tabs);
    

    function set_fix_bs_on_hidden_tabs(){
      $(".tab-pane:hidden").each(function(){
        $(".tab-pane:hidden").find("div[bs-img]").attr("fix-bs","true");
      });
    }

    $(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
      fix_backstretch($(e.target).attr("href").substring(1));
    });

    function fix_backstretch(tab){
      $("#" + tab +" div[fix-bs]").each(function() {
        if($(this).parents(".tab-pane").css('display')!="none"){        
          $(this).backstretch( $(this).attr("bs-img") );
          $(this).removeAttr("fix-bs");
        }        
      });     
    }

  
</script>

<section class="info-profile">
  <div class="tabbable">
    <ul class="nav nav-tabs">
<!--excursions-->

      <% params[:tab] == nil || params[:tab] == "excursions"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="excursions_tab" href="#tab1" data-toggle="tab">
          <i class="icon-book"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('excursion.other')%></span>
        </a>
      </li>
<!--resources-->      
      <%if params[:tab] == "resources"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="resources_tab" href="#tab3" data-toggle="tab">
          <i class="icon-file"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('resource.other')%></span>
        </a>
      </li>
<!--events-->
      <%if params[:tab] ==  "events"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="events_tab" href="#tab2" data-toggle="tab">
          <i class="icon-facetime-video"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('event.other')%></span>
        </a>
      </li>
      <%if params[:tab] == "categories"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="categories_tab" href="#tab4" data-toggle="tab">
          <i class="icon-th-large"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('categories.other')%></span>
        </a>
      </li>
      
      <li class="follow-tab">
        <a id="followers_tab" href="#tab5" data-toggle="tab">
          <span><%= profile_subject.followers.count.to_s %></span>
          <i class="icon-group "></i>
          <span class=" hidden-phone hidden-tablet"><%= t('follow.followers') %></span>
        </a>
      </li>

      <li class="follow-tab">
        <a id="followings_tab" href="#tab6" data-toggle="tab">
          <span><%= profile_subject.following_actor_objects.includes(:actor).count.to_s %></span>
          <i class="icon-group green"></i>
          <span class=" hidden-phone hidden-tablet"><%= t('follow.followings') %></span>
        </a>
      </li>

    </ul>


    <div class="tab-content">
      
      <div class="tab-pane active" id="tab1">
          <%= render partial: 'users/order_by_dropdown_excursions' %>
          <% default_sort_by = profile_subject_is_current? ? "updated_at" : "popularity"%>
          <%= render partial: 'excursions/profile_excursions', :locals => {:scope => :me, :limit => 0, :page=> 1, :sort_by=> params[:sort_by]||default_sort_by}%>
          <div class="loader_pagination" style="display:none">
            <div id="pageless-loader" style="text-align:center;width:100%;">
              <div class="msg" style="font-size:2em">
                <%=t('search.loading')%>
              </div>
              <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
            </div>
          </div>
      </div>

      <div class="tab-pane" id="tab2">
        <%= render partial: 'users/order_by_dropdown_events' %>
        <div id="events_tab_ready"></div>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>

      <div class="tab-pane" id="tab3">
        <%= render partial: 'users/order_by_dropdown_resources' %>
        <div id="resources_tab_ready"></div>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>

      <div class="tab-pane" id="tab4">
        <div id="categories_tab_ready"></div>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>        
      </div>

      <div class="tab-pane" id="tab5">
        <ul id="followers_ul">
          
        </ul>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>

      <div class="tab-pane" id="tab6">
        <ul id="followings_ul">
         
        </ul>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>
      

    </div>
  </div>
</section>
<commit_msg>ifmissing0<commit_after><%= content_for :javascript do %>
  
  $("#excursions_tab").click(function(){
    re_apply_pageless("excursions");
  });

  var resources_tab_loaded = false;
  $("#resources_tab").click(function(){
    if(resources_tab_loaded===false){
      $('.loader_pagination').show();
      resources_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/resources",
          success : function(html) {
            $('.loader_pagination').hide();      
            $("#resources_tab_ready").append(html);
            re_apply_pageless("resources");
            re_apply_backstrech("resources");
          },
          error: function(){
            //console.log("error loading resources");
         }
        });

    } else {
      re_apply_pageless("resources");
    }
  });

  var events_tab_loaded = false;
  $("#events_tab").click(function(){
    if(events_tab_loaded===false){
      $('.loader_pagination').show();
      events_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/events",
          success : function(html) {  
            $('.loader_pagination').hide();
            $("#events_tab_ready").append(html);
            re_apply_pageless("events");
            re_apply_backstrech("events");
          },
          error: function(){
            //console.log("error loading events");
         }
        });

    } else {
      re_apply_pageless("events");
    }
  });

  var categories_tab_loaded = false;
  $("#categories_tab").click(function(){
    if(categories_tab_loaded===false){
      $('.loader_pagination').show();
      categories_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/categories",
          success : function(html) {      
            $('.loader_pagination').hide();
            $("#categories_tab_ready").append(html);
            re_apply_pageless("categories");
          },
          error: function(){
            //console.log("error loading categories");
         }
        });
    } else {
      re_apply_pageless("categories");
    }
  });

  var followers_tab_loaded = false;
  $("#followers_tab").click(function(){
    if(followers_tab_loaded===false){
      $('.loader_pagination').show();
      followers_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/followers",
          success : function(html) {
            $('.loader_pagination').hide();
            $("#followers_ul").prepend(html);
            re_apply_pageless("followers");
          },
          error: function(){
            //console.log("error loading followers");
         }
        });
    } else {
      re_apply_pageless("followers");
    }
  });

  var followings_tab_loaded = false;
  $("#followings_tab").click(function(){
    if(followings_tab_loaded===false){
      $('.loader_pagination').show();
      followings_tab_loaded = true;
      $.ajax({
          type : "GET",
          url : "<%= user_url(profile_subject) %>/followings",
          success : function(html) {
            $('.loader_pagination').hide();   
            $("#followings_ul").prepend(html);
            re_apply_pageless("followings");
          },
          error: function(){
            //console.log("error loading followings");
         }
        });

    } else {
      re_apply_pageless("followings");
    }
  });
<%end%>

<script>
//important that this is here and not in document ready, so they are defined when document is ready and we can use them
var pageless_state = {
      "excursions":{
        "url": "<%= user_url(profile_subject) %>",
        "num_pages":0,
        "current_page":0
      },
      "events":{
        "url": "<%= user_url(profile_subject) %>/events",
        "num_pages":0,
        "current_page":0
      },
      "resources":{
        "url": "<%= user_url(profile_subject) %>/resources",
        "num_pages":0,
        "current_page":0
      },
      "categories":{
        "url": "<%= user_url(profile_subject) %>/categories",
        "num_pages":0,
        "current_page":0
      },
      "followers":{
        "url": "<%= user_url(profile_subject) %>/followers",
        "num_pages":0,
        "current_page":0
      },
      "followings":{
        "url": "<%= user_url(profile_subject) %>/followings",
        "num_pages":0,
        "current_page":0
      }
    };

function update_pageless_state(tab, num_pages, current_page){
    pageless_state[tab].num_pages = num_pages;
    pageless_state[tab].current_page = current_page;
}

function re_apply_pageless(tab){
    //first remove old pageless
    $.pagelessStop();
    $("#" + tab + "_tab_ready ul").pageless({ 
                    totalPages: pageless_state[tab].num_pages ,
                    url: get_url_with_sort_by(tab),
                    currentPage: pageless_state[tab].current_page,
                    loader: '.loader_pagination',
                    end: function(){
                      $('.loader_pagination').hide();
                    }
    });
  }

function get_url_with_sort_by(tab){
  var the_url = pageless_state[tab].url;

  the_url = the_url + "?sort_by=" + $("#order_by_selector_" + tab).attr("li_selected");
  return the_url;
}

  function re_apply_backstrech(tab){
    $("#" + tab + "_tab_ready"  + " div[bs-img]").each(function() {
          if($(this).parents(".tab-pane").css('display')!="none"){        
            $(this).backstretch( $(this).attr("bs-img") );   
            if($(this).parents(".tab-pane").css('display')=="none"){
              $(this).attr("fix-bs", "true");
            }
          }
          else{
            $(this).attr("fix-bs", "true");
          }   
    });
  };

    $(window).on('resize.backstretch', set_fix_bs_on_hidden_tabs)
             .on('orientationchange.backstretch', set_fix_bs_on_hidden_tabs);
    

    function set_fix_bs_on_hidden_tabs(){
      $(".tab-pane:hidden").each(function(){
        $(".tab-pane:hidden").find("div[bs-img]").attr("fix-bs","true");
      });
    }

    $(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
      fix_backstretch($(e.target).attr("href").substring(1));
    });

    function fix_backstretch(tab){
      $("#" + tab +" div[fix-bs]").each(function() {
        if($(this).parents(".tab-pane").css('display')!="none"){        
          $(this).backstretch( $(this).attr("bs-img") );
          $(this).removeAttr("fix-bs");
        }        
      });     
    }

  
</script>

<section class="info-profile">
  <div class="tabbable">
    <ul class="nav nav-tabs">
<!--excursions-->

      <%if params[:tab] == nil || params[:tab] == "excursions"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="excursions_tab" href="#tab1" data-toggle="tab">
          <i class="icon-book"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('excursion.other')%></span>
        </a>
      </li>
<!--resources-->      
      <%if params[:tab] == "resources"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="resources_tab" href="#tab3" data-toggle="tab">
          <i class="icon-file"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('resource.other')%></span>
        </a>
      </li>
<!--events-->
      <%if params[:tab] ==  "events"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="events_tab" href="#tab2" data-toggle="tab">
          <i class="icon-facetime-video"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('event.other')%></span>
        </a>
      </li>
      <%if params[:tab] == "categories"%>
        <li class="active">
      <%else%>
        <li>
      <%end%>
        <a id="categories_tab" href="#tab4" data-toggle="tab">
          <i class="icon-th-large"></i>
          <span class=" hidden-phone hidden-tablet"><%=t('categories.other')%></span>
        </a>
      </li>
      
      <li class="follow-tab">
        <a id="followers_tab" href="#tab5" data-toggle="tab">
          <span><%= profile_subject.followers.count.to_s %></span>
          <i class="icon-group "></i>
          <span class=" hidden-phone hidden-tablet"><%= t('follow.followers') %></span>
        </a>
      </li>

      <li class="follow-tab">
        <a id="followings_tab" href="#tab6" data-toggle="tab">
          <span><%= profile_subject.following_actor_objects.includes(:actor).count.to_s %></span>
          <i class="icon-group green"></i>
          <span class=" hidden-phone hidden-tablet"><%= t('follow.followings') %></span>
        </a>
      </li>

    </ul>


    <div class="tab-content">
      
      <div class="tab-pane active" id="tab1">
          <%= render partial: 'users/order_by_dropdown_excursions' %>
          <% default_sort_by = profile_subject_is_current? ? "updated_at" : "popularity"%>
          <%= render partial: 'excursions/profile_excursions', :locals => {:scope => :me, :limit => 0, :page=> 1, :sort_by=> params[:sort_by]||default_sort_by}%>
          <div class="loader_pagination" style="display:none">
            <div id="pageless-loader" style="text-align:center;width:100%;">
              <div class="msg" style="font-size:2em">
                <%=t('search.loading')%>
              </div>
              <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
            </div>
          </div>
      </div>

      <div class="tab-pane" id="tab2">
        <%= render partial: 'users/order_by_dropdown_events' %>
        <div id="events_tab_ready"></div>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>

      <div class="tab-pane" id="tab3">
        <%= render partial: 'users/order_by_dropdown_resources' %>
        <div id="resources_tab_ready"></div>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>

      <div class="tab-pane" id="tab4">
        <div id="categories_tab_ready"></div>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>        
      </div>

      <div class="tab-pane" id="tab5">
        <ul id="followers_ul">
          
        </ul>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>

      <div class="tab-pane" id="tab6">
        <ul id="followings_ul">
         
        </ul>
        <div class="loader_pagination" style="display:none">
          <div id="pageless-loader" style="text-align:center;width:100%;">
            <div class="msg" style="font-size:2em">
              <%=t('search.loading')%>
            </div>
            <img src="/assets/load.gif" alt="loading more results" style="margin:10px auto" />
          </div>
        </div>
      </div>
      

    </div>
  </div>
</section>

{'fraction_non_alphanumeric': 0.18780862276443006, 'fraction_numerical': 0.0052699282127889125, 'mean_word_length': 2.1806783687475253, 'pattern_counts': {'":': 48, '<': 357, '<?xml version=': 0, '>': 367, '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': '4876826', 'n_tokens_mistral': 7694, 'n_tokens_neox': 7495, 'n_words': 1193}