<commit_before>var prev = document.querySelector(".prevItem");
var next = document.querySelector(".nextItem");
var items = document.querySelector(".carousel-container ol");

var width = items.querySelector("li").getBoundingClientRect().width;

var left = 0;
/*
var clickCountLeft = 0;
var clickCountRight = 0;
var itemsCount = items.childNodes;
*/
/* divide itemsCount by two as it counts both <li> and <p> */

prev.addEventListener("click",rollLeft);
next.addEventListener("click",rollRight);

console.log("width times 3 = " + width*3);

function rollLeft() {

  if (Math.abs(left) == (width*3)) {
    left = 0;
  }

  if ((Math.abs(left) < width*3) && left !=0 ) {
    left = left + width;
    items.style.left = left + "px";
  }
  console.log(Math.abs(left));
}

function rollRight() {

  if (Math.abs(left) == (width*3)) {
    left = 0;
  }

  if (Math.abs(left) < width*3 && left != width*3 ) {
    left = left - width;
    items.style.left = left + "px";
  }
  console.log(Math.abs(left));
}

/* Click count solution for The Hall of Fame

function rollLeft(){
  clickCountRight = 0;
  clickCountLeft += 2.5;
  if (clickCountLeft < (itemsCount.length)) {
    left = left + width;
    items.style.left = left + "px";
  }
  console.log(itemsCount.length);
  console.log(clickCountLeft);
  console.log(left);
}

function rollRight(){
  clickCountLeft = 0;
  clickCountRight += 2.5;
  if (clickCountRight < (itemsCount.length)) {<commit_msg>almost 100% fixed left-right navigation, added updateWidth() to carousel<commit_after>var prev = document.querySelector(".prevItem");
var next = document.querySelector(".nextItem");
var items = document.querySelector(".carousel-container ol");

var width = items.querySelector("li").getBoundingClientRect().width;

var left = 0;

/*
var clickCountLeft = 0;
var clickCountRight = 0;
var itemsCount = items.childNodes;
*/
/* divide itemsCount by two as it counts both <li> and <p> */

window.addEventListener("resize",updateWidth);
prev.addEventListener("click",rollLeft);
next.addEventListener("click",rollRight);

function updateWidth() {
  width = items.querySelector("li").getBoundingClientRect().width;
}

console.log("width times 3 = " + width*3);

function rollLeft() {

  if (left == 0) {
    prev.style.display = "none";
    next.style.display = "inline-block";
  }

  if ((Math.abs(left) < width*3) && left !=0 ) {
    left = left + width;
    items.style.left = left + "px";
  }
  console.log(Math.abs(left));
}

function rollRight() {

  if (Math.abs(left) == (width*3)) {
    left = 0;
    next.style.display = "none";
    prev.style.display = "inline-block";
  }

  if (Math.abs(left) < width*3 && left != width*3 ) {
    left = left - width;
    items.style.left = left + "px";
  }
  console.log(Math.abs(left));
}

/* Click count solution for The Hall of Fame

function rollLeft(){
  clickCountRight = 0;
  clickCountLeft += 2.5;
  if (clickCountLeft < (itemsCount.length)) {
    left = left + width;
    items.style.left = left + "px";
  }
  console.log(itemsCount.length);
  console.log(clickCountLeft);
  console.log(left);
}

function rollRight(){
  clickCountLeft = 0;
  clickCountRight += 2.5;
  if (clickCountRight < (itemsCount.length)) {
{'fraction_non_alphanumeric': 0.1645846346033729, 'fraction_numerical': 0.012492192379762648, 'mean_word_length': 3.853030303030303, 'pattern_counts': {'":': 0, '<': 15, '<?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': '612557', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1064, 'n_words': 249}