<commit_before>/*
The HTML language is assigned to english and the class should be assigned to Javascript.
The bulk of the document is an unordered list with `<h3>` tags for each heading.
The unordered list has an id of "cpb-ntaccordion" and a class of "cbp-ntaccordion"
The `h3` element has a class set to "cpb-nttrigger"
Each heading accordions open to a description and sub-accordions.
When accordion is opened, list has a class of 'cbp-ntopen'
Inside of a <div> element, a description is written inside a paragraph tag.
The div element has a class set to "cbp-ntcontent"
Also inside of the div element is another unordered list with the class of "cbp-ntsubaccordion"
Each item in the sub-list has a header with the class "cbp-nttrigger" and div element with the class "cbp-ntcontent"

In order to use JavaScript with our HTML file, link to our .js file within a `<script>` tag on the .html page with the source set to the file path
Need to create an array to hold the accordion items???
Create function to initiate JavaScript???
  * use getElementsByTagName() to call array
  * create for loop with if statements that trigger different items either onload or ontoggle
Need to write a `toggleItem()` onclick function that is assigned to the <h3> element.
  // toggleItem() hides or shows all the items in the list when it is clicked on (onclick)
    // aka will expand and collapse accordion
Need to call the id "cpb-ntaccordion" using the `Document` prototype document.getElementById()
**/


var heading = document.querySelector('.cbp-nttrigger');
  heading.addEventListener('click', function(){ //function to expand header
  if (document.querySelector('li').className !== "cbp-ntopen"){
    document.querySelector('li').className = "cbp-ntopen";
    return true;
  }
  if (document.querySelector('li').className === "cbp-ntopen"){
    document.querySelector('li').className = "";
    return true;
  }
});

/*
var collapse = document.querySelector("li").className = "cbp-ntopen" ;// `.` = class
  collapse.addEventListener('click', function(){ //trying to remove class of "cbp-ntopen"
    document.querySelector('li').removeClass("cbp-ntopen");
  }
**/
// heading.addEventListener('click', function(){ //function to collapse header
//   document.querySelector('li').className = "cbp-ntclose"; // lol this didnt work
// });<commit_msg>pseudocode<commit_after>/*
The HTML language is assigned to english and the class should be assigned to Javascript.
The bulk of the document is an unordered list with `<h3>` tags for each heading.
The unordered list has an id of "cpb-ntaccordion" and a class of "cbp-ntaccordion"
The `h3` element has a class set to "cpb-nttrigger"
Each heading accordions open to a description and sub-accordions.
When accordion is opened, list has a class of 'cbp-ntopen'
Inside of a <div> element, a description is written inside a paragraph tag.
The div element has a class set to "cbp-ntcontent"
Also inside of the div element is another unordered list with the class of "cbp-ntsubaccordion"
Each item in the sub-list has a header with the class "cbp-nttrigger" and div element with the class "cbp-ntcontent"

In order to use JavaScript with our HTML file, link to our .js file within a `<script>` tag on the .html page with the source set to the file path
Need to create an array to hold the accordion items???
Create function to initiate JavaScript???
  * use getElementsByTagName() to call array
  * create for loop with if statements that trigger different items either onload or ontoggle
Need to write a `toggleItem()` onclick function that is assigned to the <h3> element.
  // toggleItem() hides or shows all the items in the list when it is clicked on (onclick)
    // aka will expand and collapse accordion
Need to call the id "cpb-ntaccordion" using the `Document` prototype document.getElementById()
**/

//OPENING & CLOSING ACCORDION
var heading = document.querySelector('.cbp-nttrigger'); //d
  heading.addEventListener('click', function(){ // the `addEventListener` listens to the Event type `click`
  if (document.querySelector('li').className !== "cbp-ntopen"){ // method `querySelector` selects the element <li>
                                                                // if the class attribute is not equal to "cbp-ntopen" then..
    document.querySelector('li').className = "cbp-ntopen"; //..the event type `click` changes the class attribute to "cbp-ntopen"
    return true;
  }
  if (document.querySelector('li').className === "cbp-ntopen"){ // if the class attribute is strictly equal to "cbp-ntopen"..
    document.querySelector('li').className = null; //..the event type `click` changes the class attribute to null
    return true;
  }
});

/*
var collapse = document.querySelector("li").className = "cbp-ntopen" ;// `.` = class
  collapse.addEventListener('click', function(){ //trying to remove class of "cbp-ntopen"
    document.querySelector('li').removeClass("cbp-ntopen");
  }
{'fraction_non_alphanumeric': 0.10103259769184045, 'fraction_numerical': 0.0012148208139299453, 'mean_word_length': 4.035677879714577, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2735042', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1334, 'n_words': 616}