<commit_before>window.NatoClock = function(canvas, config) {
  config = config || {};
  var frame = 100 / 60;
  var width = config.width || 500,
      height = config.height || 500,
      color = config.color || '#fefefe',
      colors = config.colors || {},
      background = config.background || '#333',
      txtcolor = config.txtcolor || 'rgba(255,255,255,0.5)',
      acceleration = config.acceleration || 2.5,
      dpiScale = config.dpiScale || 1;

  var rafid;

  var getMinEdge = function () {
    return width > height ? height : width;
  }

  /* DateUtil: extented date */
  var DateUtil = function (d) {
    this.getSeconds = function () {
      return d.getSeconds();
    }

    this.isLeapYear = function () {
      var year = d.getFullYear();
      if((year & 3) != 0) return false;
      return ((year % 100) != 0 || (year % 400) == 0);
    };

    this.getYearDays =  function () {
      return this.isLeapYear() ? 366 : 365;
    };

    this.getMonthDays = function () {
      var _d = new Date(d.getFullYear(), d.getMonth() + 1, 0);
      return _d.getDate();
    };

    this.getDayOfYear = function() {
      var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
      var mn = d.getMonth();
      var dn = d.getDate();
      var dayOfYear = dayCount[mn] + dn;
      if(mn > 1 && this.isLeapYear()) dayOfYear++;
      return dayOfYear;
    };

    this.getMillisecondsOfMinutes = function () {
      return d.getMilliseconds() + 1000 * d.getSeconds() - 1;
    };

    this.getSecondsOfHour = function() {
      return d.getSeconds() + 60 * d.getMinutes();
    };

    this.getSecondsOfDay = function() {
      return d.getSeconds() + (60 * d.getMinutes()) + (3600 * d.getHours());
    };

    this.getSecondsOfWeek = function() {
      var day = d.getDay();
      day = (day == 0 ? 7 : day);
      return this.getSecondsOfDay() + 86400 * (day - 1);
    };

    this.getSecondsOfMonth = function() {
      return this.getSecondsOfDay() + 86400 * (d.getDate() - 1);
    };

    this.getSecondsOfYear = function () {
      return this.getSecondsOfDay() + 86400 * (this.getDayOfYear() - 1);
    };

    this.percentOf = function(unit) {
      var percent = function(part, full) { return part == 0 ? 0 : (full/part) };
      if (unit == 'min') return percent(60000, d.getMilliseconds() + 1000 * d.getSeconds());
      if (unit == 'hrs') return percent(3600, this.getSecondsOfHour());
      if (unit == 'day') return percent(3600 * 24, this.getSecondsOfDay());
      if (unit == 'week') return percent(86400 * 7, this.getSecondsOfWeek());
      if (unit == 'mon') return percent(this.getMonthDays() * 86400, this.getSecondsOfMonth());
      if (unit == 'yrs') return percent(this.getYearDays() * 86400, this.getSecondsOfYear());
    };

    this.isFinished = function (unit) {
      if (unit == 'min') return (d.getSeconds() >= 59 && d.getMilliseconds() >= 950);
      if (unit == 'hrs') return (this.getSecondsOfHour() >= 3599 && d.getMilliseconds() >= 950);
      if (unit == 'day') return (this.getSecondsOfDay() >= 86399 && d.getMilliseconds() >= 950);
      if (unit == 'week') return (this.getSecondsOfWeek() >= 604799 && d.getMilliseconds() >= 950);
      if (unit == 'mon') return (this.getSecondsOfMonth() >= ((this.getMonthDays() * 86400) - 1) && d.getMilliseconds() >= 950);
      if (unit == 'yrs') return (this.getSecondsOfYear() >= ((this.getYearDays() * 86400) - 1) && d.getMilliseconds() >= 950);
    };

    return this;
  };

  /* requestAnimationFrame related works. */
  var getRaf = function () {
    var _raf = requestAnimationFrame || webkitRequestAnimationFrame || oRequestAnimationFrame || msRequestAnimationFrame;
    return _raf || function(func) {
      window.setTimeout(func, 1000 / (config.noRafFps || 60));
    }
  };
  var raf = getRaf();

  /* get DOM element, and build our canvas */
  var ctx = canvas.getContext('2d');

  width = width * dpiScale;
  height = height * dpiScale;

  canvas.width = width;
  canvas.height = height;

  if(dpiScale != 1) {
    canvas.style.width = width/dpiScale;
    canvas.style.height = height/dpiScale;
  }

  /* Grapher: Graph our arc! */
  var Grapher = function(arc) {
    var minE = getMinEdge(),
        shift = minE/2,
        rot = arc.getRot();
    ctx.beginPath();
    ctx.arc(shift, shift, arc.r, (Math.PI/(2/3)), rot, false);
    ctx.lineWidth = getMinEdge()/2/10;
    ctx.strokeStyle = arc.color;
    ctx.stroke();
    ctx.save();
    ctx.fillStyle = background;
    ctx.translate(shift, shift);
    ctx.rotate(rot);
    ctx.font = ((14/600) * getMinEdge()) + 'px Arial Rounded MT Bold';
    var d = new DateUtil(new Date()),
        p = d.percentOf(arc.class) * 100 | 0,
        tS = p >= 10 ? 8.5 : 5.5;
    if(p > 0) ctx.fillText(p, (arc.r - (tS/600)*minE), -5);
    ctx.restore();
  }

  /* arc constructor: build our arcs! */
  var Arc = function (_config) {
    var unit = _config.class,
        r = _config.radius,
        color = _config.color,
        percent = 0,
        k = 0,
        g = acceleration,
        goBack = false;
    var update = function () { // code from @ljyloo, @magicnat edited.
      var d = new DateUtil(new Date());
      var newPercent = d.percentOf(unit) * 100;
       if (d.isFinished(unit))
         goBack = true;
       if (goBack) {
         k += frame;
         var de = (k / 100) * (k / 100) * g;
         if ((percent - de) > 0.1)
           percent -= de;
         else {
           if (d.getSeconds() > 0){
             k = 0;<commit_msg>fix status location<commit_after>window.NatoClock = function(canvas, config) {
  config = config || {};
  var frame = 100 / 60;
  var width = config.width || 500,
      height = config.height || 500,
      color = config.color || '#fefefe',
      colors = config.colors || {},
      background = config.background || '#333',
      txtcolor = config.txtcolor || 'rgba(255,255,255,0.5)',
      acceleration = config.acceleration || 2.5,
      dpiScale = config.dpiScale || 1;

  var rafid;

  var getMinEdge = function () {
    return width > height ? height : width;
  }

  /* DateUtil: extented date */
  var DateUtil = function (d) {
    this.getSeconds = function () {
      return d.getSeconds();
    }

    this.isLeapYear = function () {
      var year = d.getFullYear();
      if((year & 3) != 0) return false;
      return ((year % 100) != 0 || (year % 400) == 0);
    };

    this.getYearDays =  function () {
      return this.isLeapYear() ? 366 : 365;
    };

    this.getMonthDays = function () {
      var _d = new Date(d.getFullYear(), d.getMonth() + 1, 0);
      return _d.getDate();
    };

    this.getDayOfYear = function() {
      var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
      var mn = d.getMonth();
      var dn = d.getDate();
      var dayOfYear = dayCount[mn] + dn;
      if(mn > 1 && this.isLeapYear()) dayOfYear++;
      return dayOfYear;
    };

    this.getMillisecondsOfMinutes = function () {
      return d.getMilliseconds() + 1000 * d.getSeconds() - 1;
    };

    this.getSecondsOfHour = function() {
      return d.getSeconds() + 60 * d.getMinutes();
    };

    this.getSecondsOfDay = function() {
      return d.getSeconds() + (60 * d.getMinutes()) + (3600 * d.getHours());
    };

    this.getSecondsOfWeek = function() {
      var day = d.getDay();
      day = (day == 0 ? 7 : day);
      return this.getSecondsOfDay() + 86400 * (day - 1);
    };

    this.getSecondsOfMonth = function() {
      return this.getSecondsOfDay() + 86400 * (d.getDate() - 1);
    };

    this.getSecondsOfYear = function () {
      return this.getSecondsOfDay() + 86400 * (this.getDayOfYear() - 1);
    };

    this.percentOf = function(unit) {
      var percent = function(part, full) { return part == 0 ? 0 : (full/part) };
      if (unit == 'min') return percent(60000, d.getMilliseconds() + 1000 * d.getSeconds());
      if (unit == 'hrs') return percent(3600, this.getSecondsOfHour());
      if (unit == 'day') return percent(3600 * 24, this.getSecondsOfDay());
      if (unit == 'week') return percent(86400 * 7, this.getSecondsOfWeek());
      if (unit == 'mon') return percent(this.getMonthDays() * 86400, this.getSecondsOfMonth());
      if (unit == 'yrs') return percent(this.getYearDays() * 86400, this.getSecondsOfYear());
    };

    this.isFinished = function (unit) {
      if (unit == 'min') return (d.getSeconds() >= 59 && d.getMilliseconds() >= 950);
      if (unit == 'hrs') return (this.getSecondsOfHour() >= 3599 && d.getMilliseconds() >= 950);
      if (unit == 'day') return (this.getSecondsOfDay() >= 86399 && d.getMilliseconds() >= 950);
      if (unit == 'week') return (this.getSecondsOfWeek() >= 604799 && d.getMilliseconds() >= 950);
      if (unit == 'mon') return (this.getSecondsOfMonth() >= ((this.getMonthDays() * 86400) - 1) && d.getMilliseconds() >= 950);
      if (unit == 'yrs') return (this.getSecondsOfYear() >= ((this.getYearDays() * 86400) - 1) && d.getMilliseconds() >= 950);
    };

    return this;
  };

  /* requestAnimationFrame related works. */
  var getRaf = function () {
    var _raf = requestAnimationFrame || webkitRequestAnimationFrame || oRequestAnimationFrame || msRequestAnimationFrame;
    return _raf || function(func) {
      window.setTimeout(func, 1000 / (config.noRafFps || 60));
    }
  };
  var raf = getRaf();

  /* get DOM element, and build our canvas */
  var ctx = canvas.getContext('2d');

  width = width * dpiScale;
  height = height * dpiScale;

  canvas.width = width;
  canvas.height = height;

  if(dpiScale != 1) {
    canvas.style.width = width/dpiScale;
    canvas.style.height = height/dpiScale;
  }

  /* Grapher: Graph our arc! */
  var Grapher = function(arc) {
    var minE = getMinEdge(),
        shift = minE/2,
        rot = arc.getRot();
    ctx.beginPath();
    ctx.arc(shift, shift, arc.r, (Math.PI/(2/3)), rot, false);
    ctx.lineWidth = getMinEdge()/2/10;
    ctx.strokeStyle = arc.color;
    ctx.stroke();
    ctx.save();
    ctx.fillStyle = background;
    ctx.translate(shift, shift);
    ctx.rotate(rot);
    ctx.font = ((14/600) * getMinEdge()) + 'px Arial Rounded MT Bold';
    var d = new DateUtil(new Date()),
        p = d.percentOf(arc.class) * 100 | 0,
        tS = p >= 10 ? 8.5 : 5.5;
    if(p > 0) ctx.fillText(p, (arc.r - (tS/600)*minE), (-5/600)*minE);
    ctx.restore();
  }

  /* arc constructor: build our arcs! */
  var Arc = function (_config) {
    var unit = _config.class,
        r = _config.radius,
        color = _config.color,
        percent = 0,
        k = 0,
        g = acceleration,
        goBack = false;
    var update = function () { // code from @ljyloo, @magicnat edited.
      var d = new DateUtil(new Date());
      var newPercent = d.percentOf(unit) * 100;
       if (d.isFinished(unit))
         goBack = true;
       if (goBack) {
         k += frame;
         var de = (k / 100) * (k / 100) * g;
         if ((percent - de) > 0.1)
           percent -= de;
         else {
           if (d.getSeconds() > 0){
             k = 0;
{'fraction_non_alphanumeric': 0.16792230189706817, 'fraction_numerical': 0.04456748661160025, 'mean_word_length': 2.5156349712827057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, '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': '6501468', 'n_tokens_mistral': 4136, 'n_tokens_neox': 3668, 'n_words': 915}