<commit_before>var UI = require('ui');
var ajax = require('ajax');
var Settings = require('settings');

var serverUrl = 'https://maker.ifttt.com/trigger/';
var keyPrefix = '/with/key/';
var key = '<KEY>';

// Set a configurable with the open callback
Settings.config(
  { url: 'http://pi.amcolash.com/pebbleiot/index.html' },
  function(e) {
    console.log('opening configurable');
  },
  function(e) {
    console.log('closed configurable');
  }
);

var triggers1 = [
  {
    title: 'Toggle Lights',
    trigger: 'toggle_lights'
  },
  {
    title: 'Toggle Lamp',
    trigger: 'toggle_lamp'
  }
];

Settings.option('triggers', triggers1);
var triggers = Settings.option('triggers');
// Create the Menu, supplying the list of fruits

if (triggers !== null && triggers.length !== 0) {
  var triggerMenu = new UI.Menu({
    sections: [{
      title: 'Trigger List',
      items: triggers
    }]
  });
  
  // Show the Menu
  triggerMenu.show();
  
  // Add a click listener for select button click
  triggerMenu.on('select', function(event) {
    ajax({
      url: serverUrl + triggers[event.itemIndex].trigger + keyPrefix + key,
      method: 'put'
    });
  });
} else {
  var card = new UI.Card({
    title: 'Set up app',
    body: 'You need to set up PebbleIoT from your phone.'
  });
  
  card.show();
}<commit_msg>Slight changes, now completely uses web config<commit_after>var UI = require('ui');
var ajax = require('ajax');
var Settings = require('settings');

var serverUrl = 'https://maker.ifttt.com/trigger/';
var keyPrefix = '/with/key/';
var key = '<KEY>';

// Set a configurable with the open callback
Settings.config(
  { url: 'http://pi.amcolash.com/pebbleiot/index.html' },
  function(e) {
    console.log('opening configurable');
  },
  function(e) {
    console.log('closed configurable');
    console.log(JSON.stringify(e));
  }
);

var triggers = Settings.option('triggers');
// Create the Menu, supplying the list of fruits

if (triggers !== null && triggers.length !== 0) {
  var triggerMenu = new UI.Menu({
    sections: [{
      title: 'Trigger List',
      items: triggers
    }]
  });
  
  // Show the Menu
  triggerMenu.show();
  
  // Add a click listener for select button click
  triggerMenu.on('select', function(event) {
    ajax({
      url: serverUrl + triggers[event.itemIndex].trigger + keyPrefix + key,
      method: 'put'
    });
  });
} else {
  var card = new UI.Card({
    title: 'Set up app',
    body: 'You need to set up PebbleIoT from your phone.'
  });
  
  card.show();
}
{'fraction_non_alphanumeric': 0.16044479745830023, 'fraction_numerical': 0.0015885623510722795, 'mean_word_length': 3.136288998357964, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1614381', 'n_tokens_mistral': 836, 'n_tokens_neox': 811, 'n_words': 225}