<commit_before>/**
 * Height of sticky menu
 */
window.setStickyHeight = function(){
  var currentTabHeight = $('.sticky-nav .nav-tabs').outerHeight(true);
  $('.nav-wrapper.sticky-nav').height(currentTabHeight);
}

$(window).on('load resize', function(){
    setStickyHeight();
});


/**
 * scrollTo functionality
 */
window.scrollToHeight = function(heightInPx) {
  $('html, body').animate({ scrollTop: heightInPx }, 600);
}

/**
 * Call this function with id of the element to scroll to.
 * You can use this both with the hash (selector) or without
 * scrollToExact('reklamasjoner') === scrollToExact('#reklamasjoner')
 */
window.scrollToExact = function(elementId) {
  var hashElementId = elementId.indexOf('#') === 0 ? elementId : '#' + elementId;
  var $elementToScrollTo = $(hashElementId);
  if($elementToScrollTo.length === 0) { return; }

  scrollToHeight($elementToScrollTo.offset().top);
}

window.scrollToWithSticky = function(elementId, offset) {
  var hashElementId = elementId.indexOf('#') === 0 ? elementId : '#' + elementId;
  var $elementToScrollTo = $(hashElementId);
  if($elementToScrollTo.length === 0) { return; }


  scrollToHeight($elementToScrollTo.offset().top - $('.sticky-nav').height() + (offset ? offset : 0));
}


/**
 * General sticky nav initialization
 */
$(window).on('load', function() {

  // for performance, dont try to initialize any more unless there is a sticky-nav on the page
  if($('.sticky-nav').length === 0) { return; } 

  $('body').scrollspy({ target: '.sticky-nav', offset: $('.sticky-nav .nav-tabs').outerHeight(true) });

  $('.sticky-nav').waypoint(function(direction) {
      if (direction === 'down') {
          $(this.element).children('.nav').addClass('affix');
      } else {
          $(this.element).children('.nav').removeClass('affix');
      }
  });

  $('.sticky-nav .nav').on('click', 'a', function(e){
      // temporary if while large-top-with-nav still has links to other pages
      if($(this).data('follow-url')) { return true; }<commit_msg>Add more offset to scrollspy so the sticky nav updates active state without scrolling so far down<commit_after>/**
 * Height of sticky menu
 */
window.setStickyHeight = function(){
  var currentTabHeight = $('.sticky-nav .nav-tabs').outerHeight(true);
  $('.nav-wrapper.sticky-nav').height(currentTabHeight);
}

$(window).on('load resize', function(){
    setStickyHeight();
});


/**
 * scrollTo functionality
 */
window.scrollToHeight = function(heightInPx) {
  $('html, body').animate({ scrollTop: heightInPx }, 600);
}

/**
 * Call this function with id of the element to scroll to.
 * You can use this both with the hash (selector) or without
 * scrollToExact('reklamasjoner') === scrollToExact('#reklamasjoner')
 */
window.scrollToExact = function(elementId) {
  var hashElementId = elementId.indexOf('#') === 0 ? elementId : '#' + elementId;
  var $elementToScrollTo = $(hashElementId);
  if($elementToScrollTo.length === 0) { return; }

  scrollToHeight($elementToScrollTo.offset().top);
}

window.scrollToWithSticky = function(elementId, offset) {
  var hashElementId = elementId.indexOf('#') === 0 ? elementId : '#' + elementId;
  var $elementToScrollTo = $(hashElementId);
  if($elementToScrollTo.length === 0) { return; }


  scrollToHeight($elementToScrollTo.offset().top - $('.sticky-nav').height() + (offset ? offset : 0));
}


/**
 * General sticky nav initialization
 */
$(window).on('load', function() {

  // for performance, dont try to initialize any more unless there is a sticky-nav on the page
  if($('.sticky-nav').length === 0) { return; } 

  $('body').scrollspy({
    target: '.sticky-nav',
    offset: $('.sticky-nav .nav-tabs').outerHeight(true) + 50
  });

  $('.sticky-nav').waypoint(function(direction) {
      if (direction === 'down') {
          $(this.element).children('.nav').addClass('affix');
      } else {
          $(this.element).children('.nav').removeClass('affix');
      }
  });

  $('.sticky-nav .nav').on('click', 'a', function(e){
      // temporary if while large-top-with-nav still has links to other pages
      if($(this).data('follow-url')) { return true; }
{'fraction_non_alphanumeric': 0.18527488496003874, 'fraction_numerical': 0.004843787842092516, 'mean_word_length': 4.067484662576687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '302967', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1264, 'n_words': 295}