<commit_before>/* global SENSORWEB_URL */
'use strict';

(function() {
  var sensorId = $.url().param('id');
  var link = document.querySelector('#link');
  var pm25 = document.querySelector('#pm25');
  var lastUpdate = document.querySelector('#last-update');
  $.ajax({
    url: API_URL + 'sensors/' + sensorId,
    dataType: 'jsonp'
  })
  .done(function(sensors) {
    var sensor = sensors[0];
    link.setAttribute('href', SENSORWEB_URL + 'sensor.html?id=' + sensorId);
    var pm25Index = sensor.pm25 || sensor.pm25Index;
    if (pm25Index < 10) {
      pm25.style.left = '50px';
    }
    pm25.innerText = pm25Index;
    lastUpdate.innerText =
      moment(sensor.latestUpdate).format('YYYY/MM/DD HH:mm');
  })
  .fail(function(error) {
    console.error(error);
  });
}());<commit_msg>Set interval for widget<commit_after>/* global SENSORWEB_URL */
'use strict';

(function() {
  var sensorId = $.url().param('id');
  var link = document.querySelector('#link');
  var pm25 = document.querySelector('#pm25');
  var lastUpdate = document.querySelector('#last-update');

  function updatePM25() {
    $.ajax({
      url: API_URL + 'sensors/' + sensorId,
      dataType: 'jsonp'
    })
    .done(function(sensors) {
      var sensor = sensors[0];
      link.setAttribute('href', SENSORWEB_URL + 'sensor.html?id=' + sensorId);
      var pm25Index = sensor.pm25 || sensor.pm25Index;
      if (pm25Index < 10) {
        pm25.style.left = '50px';
      }
      pm25.innerText = pm25Index;
      lastUpdate.innerText =
        moment(sensor.latestUpdate).format('YYYY/MM/DD HH:mm');
    })
    .fail(function(error) {
      console.error(error);
    });
  }

  updatePM25();
  // XXX: Workaround to sync PM2.5 real-time data.
  setInterval(updatePM25, 60000);
}());
{'fraction_non_alphanumeric': 0.17073170731707318, 'fraction_numerical': 0.033465683494044246, 'mean_word_length': 3.260869565217391, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1243909', 'n_tokens_mistral': 632, 'n_tokens_neox': 600, 'n_words': 113}