<commit_before>var API_ROOT = 'http://api.deserthacks.org';
var oauth = '<KEY>';

Pebble.addEventListener('topics', function(e) {
  // Show config page
  Pebble.openURL('https://www.deserthacks.org/pebble');
});


Pebble.addEventListener("Added", function() {
  console.log("Adding to Timeline");
  initialized = true;
});

Pebble.addEventListener("showConfiguration", function() {
  console.log("showing configuration");
  Pebble.openURL('http://deserthacks.org/pebble'+encodeURIComponent(JSON.stringify(options)));
});

Pebble.addEventListener("webviewclosed", function(e) {
  console.log("configuration closed");
  // webview closed
  //Using primitive JSON validity and non-empty check
  if (e.response.charAt(0) == "{" && e.response.slice(-1) == "}" && e.response.length > 5) {
    options = JSON.parse(decodeURIComponent(e.response));
    console.log("Options = " + JSON.stringify(options));
  } else {
    console.log("Cancelled");
  }<commit_msg>ready, showConfig, appMessage, etc, eventListener<commit_after>var API_ROOT = 'http://api.deserthacks.org';
var oauth = '<KEY>';
var timelineToken;

Pebble.addEventListener('ready', function() {
  timelineToken = Pebble.getTimelineToken(
    function(token) {
      timelineToken = token;
    },
    function(err) {
      console.log('Couldn\'t get token');
    });
});

Pebble.addEventListener('showConfiguration', function() {
  console.log('showing configuration');
  Pebble.openURL('http://deserthacks.org/login?pebbleTimeline='+encodeURIComponent(JSON.stringify(timelineToken)));
});

Pebble.addEventListener('webviewclosed', function(e) {
  console.log('configuration closed');
  var res = JSON.parse(decodeURIComponent(e.response));
  localStorage.setItem(0, res);
});

Pebble.addEventListener('appmessage', function(e) {
  console.log('Received message: ' + JSON.stringify(e.payload));

  if (e.payload.action) {
    switch(e.payload.action) {
      case 3:

        break;
      case 4:

        break;
      case 5:

        break;
      case 6:

        break;
    }
  }
{'fraction_non_alphanumeric': 0.1651105651105651, 'fraction_numerical': 0.003931203931203931, 'mean_word_length': 4.302083333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '2724318', 'n_tokens_mistral': 659, 'n_tokens_neox': 652, 'n_words': 105}