<commit_before>'use strict';

/**
 * Main JS file for the /r/webdev collaborative site
 */

/**
* Entry function
*/
(function($) {
   $(document).ready(initPage);
})(jQuery);

/**
* Main function. Every thing relating to page initialization should go here.
* Just attach initializing functions to the events you wish here
*/
function initPage() {
  $(document).scroll(setScrollEffectHeader);
  animateCode();
}

/**
* Sets the smooth scrolling effect on the fixed header.
*/
function setScrollEffectHeader() {
  var scroll_from_top = $(this).scrollTop(),
    $nav_container = $('header .nav-container');

  if (scroll_from_top > 470) {
    $nav_container.css('opacity', '0.7');
  } else if (scroll_from_top > 318) {
    $nav_container.css('border-bottom', '1px solid #505050');
  } else {
    $nav_container.css('opacity', '1');
    $nav_container.css('border-bottom', '0px');
  }
}

/**
* Animates the code inside the SVG window<commit_msg>'use strict' needs to be inside the lambda function. refactor some code js code on the scrollefect function<commit_after>/**
 * Main JS file for the /r/webdev collaborative site
 */

/**
* Entry function
*/
(function($) {
  'use strict';
   $(document).ready(initPage);
})(jQuery);

/**
* Main function. Every thing relating to page initialization should go here.
* Just attach initializing functions to the events you wish here
*/
function initPage() {
  $(document).scroll(setScrollEffectHeader);
  animateCode();
}

/**
* Sets the smooth scrolling effect on the fixed header.
*/
function setScrollEffectHeader() {
  var scroll_from_top = $(this).scrollTop(),
      $nav_container = $('header .nav-container'),
      nav_containerHeight = $nav_container.height(),
      osxWindow = $(".image-lockup"),
      limitOpacity = osxWindow.position().top - $nav_container.height() - 40;

  if (scroll_from_top > limitOpacity) {
    $nav_container.css('opacity', '0.7');
  }

  if (scroll_from_top > 315) {
    $nav_container.css('border-bottom', '1px solid #505050');
  }

  if (scroll_from_top <= limitOpacity) {
    $nav_container.css('opacity', '1');
    $nav_container.css('border-bottom', '0px');
  }
}

/**
* Animates the code inside the SVG window
{'fraction_non_alphanumeric': 0.15159817351598173, 'fraction_numerical': 0.015068493150684932, 'mean_word_length': 4.060046189376443, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '2587985', 'n_tokens_mistral': 707, 'n_tokens_neox': 675, 'n_words': 190}