<commit_before>function Timer(totalMinutes) {
  this.second = 1000;
  this.minute = (this.second * 60);

  this.totalMinutes = totalMinutes;
  this.warningTime = (arguments[1] !== undefined) ? (arguments[1] * this.minute) : (this.minute);
  this.finalWarning = (arguments[2] !== undefined) ? (arguments[2] * this.second) : (this.second * 10);

  this.endCount = this.minute * this.totalMinutes;
  this.remainingTime = this.endCount;
  this.warningInterval;
  this.secondsInterval;
  this.warningTimeout;
  this.endTimeout;
  this.minuteTimeout;
}

Timer.prototype.displayTime = function () {
  var timesUp, minutesLeft, msLeft, secondsLeft;
  timesUp = false;
  if (this.remainingTime < 0) { timesUp = true; }
  minutesLeft = Math.floor(Math.abs(this.remainingTime) / this.minute);
  msLeft = Math.abs(this.remainingTime) - (minutesLeft * this.minute);
  secondsLeft = Math.floor(msLeft / this.second);
  if (timesUp) {
    minutesLeft = "-" + minutesLeft;
  }
  $("#countdownDisplay").text(minutesLeft + ":" + this.pad(secondsLeft, 2));
};

Timer.prototype.startTimer = function () {
  var thisTimer = this;
  this.clearTimerHooks();
  this.secondsInterval = window.setInterval(function () { thisTimer.tick(); }, this.second);
  this.warningTimeout =  window.setTimeout(function () {  thisTimer.setWarning(); }, this.remainingTime - this.finalWarning );
  this.endTimeout = window.setTimeout(function () { thisTimer.setEndOfTime(); }, this.remainingTime );
  this.minuteTimeout =  window.setTimeout(function () { thisTimer.setMinuteWarning(); }, this.remainingTime - this.warningTime );
  this.displayTime();
  };

  Timer.prototype.setMinuteWarning = function () {
	$("#PageContainer").removeClass("KeepTalking").addClass("OneMinuteLeft"); 
  }
  

Timer.prototype.tick = function () {
  this.remainingTime = this.remainingTime - this.second;
  this.displayTime();
};

Timer.prototype.setWarning = function () {
  var countdown = $("#countdownDisplay");
  countdown.addClass("Warning");
  this.warningInterval = window.setInterval(function () {countdown.toggle(); }, 250);
};

Timer.prototype.setEndOfTime = function () {
  $("#PageContainer").removeClass("OneMinuteLeft").addClass("TimeOut");
  window.clearInterval(this.warningInterval);
  $("#countdownDisplay").removeClass("Warning").show();
};

Timer.prototype.pauseTimer = function () {
  var thisTimer = this;
  thisTimer.clearTimerHooks();
  var countdown = $("#countdownDisplay");
  countdown.show();
};

Timer.prototype.clearTimerHooks = function() {
  window.clearInterval(this.secondsInterval);
  window.clearTimeout(this.warningTimeout);
  window.clearTimeout(this.endTimeout);
  window.clearTimeout(this.minuteTimeout);
  window.clearInterval(this.warningInterval);
}

Timer.prototype.pad = function (number, length) {
  var str = number.toString();
  while (str.length < length) {str = '0' + str; }
  return str;
};

<commit_msg>hide private timer methods<commit_after>var Timer = function (totalMinutes) {
  this.second = 1000;
  this.totalMinutes = totalMinutes;
  this.minute = (this.second * 60);

  this.warningTime = (arguments[1] !== undefined) ? (arguments[1] * this.minute) : (this.minute);
  this.finalWarning = (arguments[2] !== undefined) ? (arguments[2] * this.second) : (this.second * 10);

  this.endCount = this.minute * this.totalMinutes;
  this.remainingTime = this.endCount;
};

Timer.prototype = function ($) {

  var displayTime = function (thisTimer) {
    var timesUp, minutesLeft, msLeft, secondsLeft;
    timesUp = false;
    if (thisTimer.remainingTime < 0) { timesUp = true; }
    minutesLeft = Math.floor(Math.abs(thisTimer.remainingTime) / thisTimer.minute);
    msLeft = Math.abs(thisTimer.remainingTime) - (minutesLeft * thisTimer.minute);
    secondsLeft = Math.floor(msLeft / thisTimer.second);
    if (timesUp) {
      minutesLeft = "-" + minutesLeft;
    }
    $("#countdownDisplay").text(minutesLeft + ":" + pad(secondsLeft, 2));
  };

  var startTimer = function () {
    var thisTimer = this;
    this.clearTimerHooks();
    this.secondsInterval = window.setInterval(function () { tick(thisTimer); }, this.second);
    this.warningTimeout =  window.setTimeout(function () {  setWarning(thisTimer); }, this.remainingTime - this.finalWarning );
    this.endTimeout = window.setTimeout(function () { setEndOfTime(thisTimer); }, this.remainingTime );
    this.minuteTimeout =  window.setTimeout(function () { setMinuteWarning(thisTimer); }, this.remainingTime - this.warningTime );
    displayTime(thisTimer);
    };

  var tick = function (thisTimer) {
    thisTimer.remainingTime = thisTimer.remainingTime - thisTimer.second;
    displayTime(thisTimer);
  };

 var setMinuteWarning = function (thisTimer) {
	$("#PageContainer").removeClass("KeepTalking").addClass("OneMinuteLeft"); 
  }
  

  var setWarning = function (thisTimer) {
    var countdown = $("#countdownDisplay");
    countdown.addClass("Warning");
    thisTimer.warningInterval = window.setInterval(function () {countdown.toggle(); }, 250);
  };

  var setEndOfTime = function (thisTimer) {
    $("#PageContainer").removeClass("OneMinuteLeft").addClass("TimeOut");
    window.clearInterval(thisTimer.warningInterval);
    $("#countdownDisplay").removeClass("Warning").show();
  };


  var pauseTimer = function (thisTimer) {
    thisTimer.clearTimerHooks();
    var countdown = $("#countdownDisplay");
    countdown.show();
  };

  var clearTimerHooks = function() {
    window.clearInterval(this.secondsInterval);
    window.clearTimeout(this.warningTimeout);
    window.clearTimeout(this.endTimeout);
    window.clearTimeout(this.minuteTimeout);
    window.clearInterval(this.warningInterval);
  }

  var pad = function (number, length) {
    var str = number.toString();
    while (str.length < length) {str = '0' + str; }
    return str;
  };

  return {
    startTimer: startTimer,
    pauseTimer: pauseTimer,
    clearTimerHooks: clearTimerHooks
  };
}(jQuery);







{'fraction_non_alphanumeric': 0.15098468271334792, 'fraction_numerical': 0.006059585928294899, 'mean_word_length': 4.5018518518518515, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 3, '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': '3457808', 'n_tokens_mistral': 1843, 'n_tokens_neox': 1797, 'n_words': 310}