<commit_before>var Accordion = function () {
	this.init.apply(this, arguments);
};

Accordion.defaults = {
	className: 'accordion',
	multiExpand: false,
	panelSelector: 'dd',
	triggerSelector: 'dt > a',
	activeTrigger: 'accordion-trigger--open',
	activePanel: 'accordion-panel--open'
};

Accordion.prototype.init = function (el, options) {
	// Store a reference to the jQuery element
	this.$el = $(el);

	// Set the options
	this.options = $.extend({}, Accordion.defaults, options, this.$el.data('options'));

	// Add the class
	this.$el.addClass(this.options.className);

	this.$el.on('click.bk.accordion', $.proxy(this.onClick, this));
};

Accordion.prototype.onClick = function (e) {
	var $target = $(e.target);

	if ($target.is('a')) {

		//prevent default behaviour on non-absolute links
		var href = $target.attr("href");
		if (href == "#") {
			e.preventDefault();
		}

		var $content = $target.parent().next('dd');

		this.processOptions($target, $content);
	}

};

Accordion.prototype.processOptions = function ($target, $content) {
	var $panel = this.$el.find(this.options.panelSelector),
		$trigger = this.$el.find(this.options.triggerSelector),
		activeTrigger = this.options.activeTrigger,
		activePanel = this.options.activePanel;

	if (this.options.multiExpand === true) {
		// Trigger active class
		$target.parent().toggleClass(activeTrigger);
		// Panel active class
		$content.toggleClass(activePanel);
	} else {
		// Remove all trigger active classes
		$trigger.parent().removeClass(activeTrigger);
		// Trigger active class
		$target.parent().addClass(activeTrigger);

		// Remove all panel active classes<commit_msg>allow for more flexible accordion description list terms<commit_after>var Accordion = function () {
	this.init.apply(this, arguments);
};

Accordion.defaults = {
	className: 'accordion',
	multiExpand: false,
	panelSelector: 'dd',
	triggerSelector: 'dt',
	activeTrigger: 'accordion-trigger--open',
	activePanel: 'accordion-panel--open'
};

Accordion.prototype.init = function (el, options) {
	// Store a reference to the jQuery element
	this.$el = $(el);

	// Set the options
	this.options = $.extend({}, Accordion.defaults, options, this.$el.data('options'));

	// Add the class
	this.$el.addClass(this.options.className);

	this.$el.on('click.bk.accordion', $.proxy(this.onClick, this));
};

Accordion.prototype.onClick = function (e) {
  var $target = $(e.target);
  var $dts = $('dt');

  //prevent default behaviour on non-absolute links
  if ($target.is('a')) {
    var href = $target.attr("href");
    if ($target.attr("href") == "#") {
      e.preventDefault();
    }
  }

  //find the dt parent node
  while($target.length && $.inArray($target[0], $dts) === -1) {
    $target = $target.parent();
  }

  if ($target.length) {
    var $content = $target.next('dd');
    this.processOptions($target, $content);
  }
};

Accordion.prototype.processOptions = function ($target, $content) {
	var $panel = this.$el.find(this.options.panelSelector),
		$trigger = this.$el.find(this.options.triggerSelector),
		activeTrigger = this.options.activeTrigger,
		activePanel = this.options.activePanel;

	if (this.options.multiExpand === true) {
		// Trigger active class
		$target.toggleClass(activeTrigger);
		// Panel active class
		$content.toggleClass(activePanel);
	} else {
		// Remove all trigger active classes
		$trigger.removeClass(activeTrigger);
		// Trigger active class
		$target.addClass(activeTrigger);

		// Remove all panel active classes
{'fraction_non_alphanumeric': 0.16489819328936048, 'fraction_numerical': 0.0005735589331803843, 'mean_word_length': 4.175074183976261, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2099323', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1094, 'n_words': 245}