<commit_before>$(document).ready(function(){

  //FIXED-HEADER SCRIPTS
	var previousScroll = 0, // previous scroll position
        menuOffset = $("#header").height(), // height of menu (once scroll passed it, menu is hidden)
        detachPoint = 200, // point of detach (after scroll passed it, menu is fixed)
        hideShowOffset = 6; // scrolling value after which triggers hide/show menu

    // on scroll hide/show menu
    $(window).scroll(function() {
        var currentScroll = $(this).scrollTop(), // gets current scroll position
            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling

        // if scrolled past menu
        if (currentScroll > menuOffset) {
          // if scrolled past detach point add class to fix menu
          if (currentScroll > detachPoint) {
            $("#header").addClass('detached');
          }

          // if scrolling faster than hideShowOffset hide/show menu
          if (scrollDifference >= hideShowOffset) {
            if (currentScroll > previousScroll) {

              // scrolling down; hide menu
              	$("#header").addClass("headerHidden");
              
            } else {
              // scrolling up; show menu
              	$("#header").removeClass("headerHidden");
            }
          }
        } else {
          // only remove “detached” class if user is at the top of document (menu jump fix)
          if (currentScroll <= 0){
            $("#header").removeClass("detached");
          }
        }

        // if user is at the bottom of document show menu
        if ((window.innerHeight + window.scrollY) >= Math.max($(document).height(), $(window).height())) {
          $("#header").removeClass("headerHidden");
        }

        // replace previous scroll position with new one
        previousScroll = currentScroll;
    });

  //SEARCHBOX-SCRIPTS

  $('.search_form').click(function() {
    if( !$("search_form").hasClass("selected")){
      $(this).addClass("selected");
      $(".search_field").focus();


    }
  });

//LOGO-SCRIPT
$("#logo").hover(function() {
  $("#logo #stripe").addClass('loaded');
});



 //FOOOTER-SCRIPT
  $(".top").click(function(){
    $("html, body").animate({ scrollTop: 0 }, "slow");
    
  });

  if(window.location.search){
    console.log("Haej");
  }


});
<commit_msg>Searchfield is now closed when header is detached/hidden. This happends on all pages except for search.<commit_after>$(document).ready(function(){

  //FIXED-HEADER SCRIPTS
	var previousScroll = 0, // previous scroll position
        menuOffset = $("#header").height(), // height of menu (once scroll passed it, menu is hidden)
        detachPoint = 200, // point of detach (after scroll passed it, menu is fixed)
        hideShowOffset = 6; // scrolling value after which triggers hide/show menu

    // on scroll hide/show menu
    $(window).scroll(function() {
        var currentScroll = $(this).scrollTop(), // gets current scroll position
            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling

        // if scrolled past menu
        if (currentScroll > menuOffset) {
          // if scrolled past detach point add class to fix menu
          if (currentScroll > detachPoint) {
            $("#header").addClass('detached');
            if (! window.location.search){
              $(".search_form").removeClass("selected");
            }
          }

          // if scrolling faster than hideShowOffset hide/show menu
          if (scrollDifference >= hideShowOffset) {
            if (currentScroll > previousScroll) {

              // scrolling down; hide menu
              	$("#header").addClass("headerHidden");
              
            } else {
              // scrolling up; show menu
              	$("#header").removeClass("headerHidden");
            }
          }
        } else {
          // only remove “detached” class if user is at the top of document (menu jump fix)
          if (currentScroll <= 0){
            $("#header").removeClass("detached");
          }
        }

        // if user is at the bottom of document show menu
        if ((window.innerHeight + window.scrollY) >= Math.max($(document).height(), $(window).height())) {
          $("#header").removeClass("headerHidden");
        }

        // replace previous scroll position with new one
        previousScroll = currentScroll;
    });

  //SEARCHBOX-SCRIPTS

  $('.search_form').click(function() {
    if( !$("search_form").hasClass("selected")){
      $(this).addClass("selected");
      $(".search_field").focus();


    }
  });

//LOGO-SCRIPT
$("#logo").hover(function() {
  $("#logo #stripe").addClass('loaded');
});



 //FOOOTER-SCRIPT
  $(".top").click(function(){
    $("html, body").animate({ scrollTop: 0 }, "slow");
    
  });

});

{'fraction_non_alphanumeric': 0.14588041914937333, 'fraction_numerical': 0.0028765153071707416, 'mean_word_length': 2.2026315789473685, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2399933', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1249, 'n_words': 360}