<commit_before>define(['jquery'], function() {

  'use strict';

  /************************************************************
    @author <EMAIL>
    @description Simple Accordion Script that allows for
    multiple tabs to be open. Sets ARIA-roles as well.
    @requires jQuery 1.7+
  *************************************************************/

  var Accordion = {
    DEFAULTS: {
      animationSpeed: 300
    },
    cacheElements: function() {
      this.$accordion = $('.accordion');
      this.$accordion_content = $('.accordion-content');
      this.$accordion_header = $('.accordion-header');
    },
    init: function() {
      this.cacheElements();
      this.addARIAlabels();
      this.setupAccordion();
      this.bindEvents();
    },
    setupAccordion: function() {
      this.$accordion.attr('role', 'tablist');
      this.$accordion_content.attr('aria-expanded', 'false').attr('role', 'tabpanel').hide();
      this.$accordion_header.attr('role', 'tab').attr('tabindex', '0').attr('aria-selected', 'false');

      this.$accordion.each(function() {
        $(this).trigger('accordion.initialized');
      });
    },
    bindEvents: function() {
      // Click accordion header
      this.$accordion_header.on('click', function() {
        Accordion.toggleAccordion($(this));
      });

      // tab to accordion header and press enter key
      this.$accordion_header.on('keydown', function(event) {
        if (event.keyCode === 13) {
          Accordion.toggleAccordion($(this));
        }
      });
    },
    addARIAlabels: function() {
      this.$accordion.each(function(index) {

        var
        that = $(this),
        $accordion_header = that.find('.accordion-header').attr('id', 'accordion-' + index),
        $accordion_content = that.find('.accordion-content').attr('id', 'accordion-' + index);

        $accordion_header.each(function (index){

          var that = $(this);

          // set IDs
          that
            .attr('id', that.attr('id') + '-header-' + index)
            .next()
            .attr('id', that.next().attr('id') + '-content-' + index);

          // set aria-controls
          that
            .attr('aria-controls', that.next().attr('id'));
        });

        $accordion_content.each(function() {
          var that = $(this);

          // set aria-labelledby
          that
            .attr('aria-labelledby', that.prev().attr('id'));
        });

      });
    },
    toggleAccordion: function(accordion_header) {

      var
      accordion_content = accordion_header.next();

      if (accordion_header.attr('aria-selected') === 'false') {
        // open

        // accordion-header
        accordion_header.attr('aria-selected', 'true').addClass('active');

        // accordion-content
        accordion_content.attr('aria-expanded', 'true').attr('aria-hidden', 'false');

        accordion_content.slideDown(Accordion.DEFAULTS.animationSpeed, function() {
          accordion_header.trigger('accordion.opened', [accordion_header, accordion_content]);
        });

      } else {
        // close

        // accordion-header
        accordion_header.attr('aria-selected', 'false').removeClass('active');

        // accordion-content
        accordion_content.attr('aria-expanded', 'false').attr('aria-hidden', 'true');

        accordion_content.slideUp(Accordion.DEFAULTS.animationSpeed, function() {
          accordion_header.trigger('accordion.closed', [accordion_header, accordion_content]);
        });

      }
    }
  };

  Accordion.init();

});
<commit_msg>[Task] change class name to accordion-active<commit_after>define(['jquery'], function() {

  'use strict';

  /************************************************************
    @author <EMAIL>
    @description Simple Accordion Script that allows for
    multiple tabs to be open. Sets ARIA-roles as well.
    @requires jQuery 1.7+
  *************************************************************/

  var Accordion = {
    DEFAULTS: {
      animationSpeed: 300
    },
    cacheElements: function() {
      this.$accordion = $('.accordion');
      this.$accordion_content = $('.accordion-content');
      this.$accordion_header = $('.accordion-header');
    },
    init: function() {
      this.cacheElements();
      this.addARIAlabels();
      this.setupAccordion();
      this.bindEvents();
    },
    setupAccordion: function() {
      this.$accordion.attr('role', 'tablist');
      this.$accordion_content.attr('aria-expanded', 'false').attr('role', 'tabpanel').hide();
      this.$accordion_header.attr('role', 'tab').attr('tabindex', '0').attr('aria-selected', 'false');

      this.$accordion.each(function() {
        $(this).trigger('accordion.initialized');
      });
    },
    bindEvents: function() {
      // Click accordion header
      this.$accordion_header.on('click', function() {
        Accordion.toggleAccordion($(this));
      });

      // tab to accordion header and press enter key
      this.$accordion_header.on('keydown', function(event) {
        if (event.keyCode === 13) {
          Accordion.toggleAccordion($(this));
        }
      });
    },
    addARIAlabels: function() {
      this.$accordion.each(function(index) {

        var
        that = $(this),
        $accordion_header = that.find('.accordion-header').attr('id', 'accordion-' + index),
        $accordion_content = that.find('.accordion-content').attr('id', 'accordion-' + index);

        $accordion_header.each(function (index){

          var that = $(this);

          // set IDs
          that
            .attr('id', that.attr('id') + '-header-' + index)
            .next()
            .attr('id', that.next().attr('id') + '-content-' + index);

          // set aria-controls
          that
            .attr('aria-controls', that.next().attr('id'));
        });

        $accordion_content.each(function() {
          var that = $(this);

          // set aria-labelledby
          that
            .attr('aria-labelledby', that.prev().attr('id'));
        });

      });
    },
    toggleAccordion: function(accordion_header) {

      var
      accordion_content = accordion_header.next();

      if (accordion_header.attr('aria-selected') === 'false') {
        // open

        // accordion-header
        accordion_header.attr('aria-selected', 'true').addClass('accordion-active');

        // accordion-content
        accordion_content.attr('aria-expanded', 'true').attr('aria-hidden', 'false');

        accordion_content.slideDown(Accordion.DEFAULTS.animationSpeed, function() {
          accordion_header.trigger('accordion.opened', [accordion_header, accordion_content]);
        });

      } else {
        // close

        // accordion-header
        accordion_header.attr('aria-selected', 'false').removeClass('accordion-active');

        // accordion-content
        accordion_content.attr('aria-expanded', 'false').attr('aria-hidden', 'true');

        accordion_content.slideUp(Accordion.DEFAULTS.animationSpeed, function() {
          accordion_header.trigger('accordion.closed', [accordion_header, accordion_content]);
        });

      }
    }
  };

  Accordion.init();

});

{'fraction_non_alphanumeric': 0.1950230672445128, 'fraction_numerical': 0.0022368237103313295, 'mean_word_length': 2.553899652260308, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '705155', 'n_tokens_mistral': 2147, 'n_tokens_neox': 2017, 'n_words': 325}